Popover in SwiftUI is showing a sheet. Anyone else?

Hi, I have been trying to use a popover in SwiftUI in Xcode 12 Beta 2&3 and popovers are showing up as sheets. Here is my code:
Code Block struct MasterView: View {
@State private var showPopover: Bool = false
var body: some View {
VStack {
Button("Show popover") {
self.showPopover = true
}.popover(
isPresented: self.$showPopover,
arrowEdge: .bottom
) { Text("Popover") }
}
}
}

However, no popover is presented. Instead it's a sheet. I submitted feedback, but I don't see anyone else complaining about it. I want to confirm I'm not the only one.
Post not yet marked as solved Up vote post of ericagredo Down vote post of ericagredo
9.3k views

Replies

Hello Eric, I've been playing with popover and I cannot get presented as a popover. I tried different attachmentAnchor and content views.
Yeah same. I guess we shall wait to see if it's fixed in the next beta.
What device are you testing? Popovers are presented as sheets in compact environments. But work fine on iPad. When using UIKit, there are ways to get popovers on iPhone (using adaptivePresentationStyle) but that is not directly available in SwiftUI. At least not yet.
@travis78701 I tested it through simulator on every type of iphone and then used my personal iPhone XS Max and none of it works.
Popovers are meant to be shown as sheets on iPhone. If you run the app on an iPad or a Mac if its a universal app, you will see it display as a small overlay as the name suggests. Hope this helps.
Hi, I wrote a little project, maybe it is helpful. https://github.com/DominikButz/DYPopoverView

However, it doesn't work if the anchorView is in the navigation bar...
correction: it works if you attach the popover modifier to a GeometryReader which is the top view in the body. Check out the updated example:  https://github.com/DominikButz/DYPopoverViewExample  

I can confirm this is still the behaviour on iOS 16.

Its a shame because popover bubbles are very common on iOS for providing users with tutorials on how to use the app.

This should be fixed.

If you wanted to show a sheet instead of a popover on iPhone, you could easily just create a view modifier that does the existing behaviour.

This fixed on iOS 16.4

adding .presentationCompactAdaptation((.popover)) will make it appear as popover on iPhone

.popover(isPresented: isPresented) {
            // Your View
                    .presentationCompactAdaptation((.popover))
            }