I'd like the view to instantly appear. Instead of the default iOS push animation.
This method USED to work with a NavigationView
+ NavigationLink
. iOS 16 deprecated NavigationView
enum Nav {
case a
}
struct ContentView: View {
@State var nav: [Nav] = []
var body: some View {
NavigationStack(path: $nav) {
Button {
var transaction = Transaction()
transaction.disablesAnimations = true
withTransaction(transaction) {
nav = [.a] // Doesn't work. Still animates
}
} label: {
Text("Go to a")
}
.navigationDestination(for: Nav.self) { path in
switch path {
case .a:
Text("a")
}
}
}
}
}