SwiftUI weird animation when showing popover on iPhone

Viewed 176

If I show a popover in SwiftUI on the iPhone, and dismiss by swiping down the popover, the dismiss animation is incorrect.

This happens with Xcode 12.0.1, on iOS 14.0.1.

struct MyPopover: View {
    var body: some View {
        VStack {
            Spacer()
            Button("Show alert") {
                // blah
            }
            Spacer()
        }
        .frame(maxWidth: .infinity)
        .background(Color.green.edgesIgnoringSafeArea(.all))
    }
}

struct ContentView: View {
    @State private var isShowingPopover = false
    
    var body: some View {
        Button("Tap me to show a popover!") {
            self.isShowingPopover.toggle()
        }
        .popover(isPresented: self.$isShowingPopover) {
            MyPopover()
        }
    }
}

This is the result:

enter image description here

The "fix" is to use .sheet() on iPhone, but is there a reason why this behavior exists?

0 Answers
Related