How to use popover in SwiftUI

Issue #882

In SwiftUI, .popover shows as popover on Mac and iPad, but as .sheet on iPhone (compact size class)

We can use minWidth, minHeight to specify sizes on Mac and iPad. On iPhone, we can check and wrap it inside NavigationView. Setting navigationTitle without being embedded in NavigationView has not effect

``

.popover(isPresented: $showsEdit) {
    EditSnippetView(
        snippet: snippet
    )
    .frame(minWidth: 300, alignment: .topLeading)
    .navigationTitle("Tags")
    .modifier(
        EmbedInNavigationModifier()
    )
}
Written by

I’m open source contributor, writer, speaker and product maker.

Start the conversation