Does anyone have any idea how to present a popover from SwiftUI Button in a macOS application. I can't find any documentation on this anywhere.
Present Popover in macOS
Add a Comment
Does anyone have any idea how to present a popover from SwiftUI Button in a macOS application. I can't find any documentation on this anywhere.
Never mind, I figured it out.
@State private var showPopup = false
var body: some View {
Button(action: {
self.showPopup = true
}) {
Text("Popover Button")
}
.presentation(showPopup ? Popover(content: PopoverContent(), dismissHandler: { self.showPopup = false }) : nil)
}
Never mind, I figured it out.
@State private var showPopup = false
var body: some View {
Button(action: {
self.showPopup = true
}) {
Text("Popover Button")
}
.presentation(showPopup ? Popover(content: PopoverContent(), dismissHandler: { self.showPopup = false }) : nil)
}