I'm curious, is there a way to override the default slide-in behaviour when navigating in SwiftUI? Here's some code where I'm unsuccessfully attempting to use .transition
to affect the animation:
struct TransitionOnNavigation: View {
var body: some View {
NavigationStack {
NavigationLink("Press Me") {
Text("Hello World!")
.transition(.move(edge: .bottom)) // this doesn't do anything
}
}
}
}
I'm surprised that I haven't found anything in my searches for something so fundamental, and I don't recall seeing anything about this in WWDC videos. I did find this library, but I wonder if there's something built-in that I'm missing.
Ideally, I'd want to:
Change the basic type of transition (move, scale, fade, etc)
Affect the rate of animation (eg using
duration
parameters)Have the ability to use matchedGeometryEffect control individual views in interesting ways.