为什么我的视图第一次出现在 swiftUI 的屏幕上时没有转换

Why is my view not transitioning when first appeared on screen in swiftUI

我想要一个简单的视图,在应用首次加载时从 0 缩放到 1。我这里的代码怎么没有 happening.Look:

struct ContentView: View {
    
    @State private var isLoadng = false
    
    var body: some View {
        
        ZStack {
            if isLoadng {
                Color.red
                    .cornerRadius(20)
                    .frame(width: 150, height: 200)
                    .transition(.scale)
               
            }
            
            
        }
        
        .onAppear {
            withAnimation(.easeInOut(duration: 2)) {
                self.isLoadng = true
            }
        }
    }
}

视图只是弹出,没有任何过渡

这里是修改的部分。用 Xcode 12

测试
var body: some View {
    ZStack {
        if isLoadng {
            Color.red
                .cornerRadius(20)
                .frame(width: 150, height: 200)
                .transition(.scale)
        }
    }
    .animation(.easeInOut(duration: 2))
    .onAppear {
        self.isLoadng = true
    }
}