Open jeanbaptistebeau opened 1 year ago
That could actually be a general bug in SwiftUI, according to this SO answer. I'm currently investigating this.
Opacity transition (which should be default) has always been finicky. IIRC it only works if the .animation
is applied directly to a top-level view which is rendered conditionally.
I.e.:
Group {
if showText {
Text("Hello world")
.animation(.linear)
}
}
This is most likely due to Route
views always being rendered. It's only the content (the child views) which are rendered conditionally. Or something along those lines 😛
Fair warning: the Animating Routes documentation no longer works as expected since iOS 16.
I followed the doc Animating Routes and tried to replace the transition with
.opacity
, but it doesn't work. When using.move(edge: .bottom).combined(with: .opacity)
, only themove
transition is executed.