Unwanted frame animations in SwiftUI 2

In iOS13/SwiftUI 1 you could have code like this inside a NavigationView without the frame moving.

Code Block swift
struct MyView: View {
    @State var color: Color = .blue
    var body: some View {
        Text("Hello, World!")
            .background(color)
            .animation(.default)
            .onAppear {
                color = .red
            }
    }
}

This would animate the color from blue to red when the view appeared as expected. But in iOS 14/SwiftUI 2 this is no longer the case, when the view appears the entire thing animates in from the top right like some sort of 90s slideshow transition.

If the view is not a child of a NavigationView this problem disappears.

Is this an intended change or a bug? The only workaround I've found so far is using .animation(.default, value: ..) and while that works well for the contrived example above it is very limiting when working with more complex views.

Is this an intended change or a bug? 

Not sure. You should better send a feedback of this issue as a bug, we do not expect animations that we do not write explicitly and not documented.

Another workaround:
Code Block
struct MyView: View {
@State var color: Color = .blue
var body: some View {
Text("Hello, World!")
.background(color)
.onAppear {
DispatchQueue.main.async {
withAnimation(.easeInOut(duration: 2)) {
color = .red
}
}
}
}
}


Unwanted frame animations in SwiftUI 2
 
 
Q