I’m working on a Mac menu bar application and have this working code that opens/closes the window when toggling the menu bar app icon
@objc func togglePopover(_ sender: AnyObject?) {
if let button = statusBarItem.button {
if popover.isShown {
popover.performClose(sender)
} else {
popover.show(relativeTo: button.bounds, of: button, preferredEdge: NSRectEdge.minY)
}
}
}
I’m trying to add this function that will programmatically open the window after the user has logged in (which occurs via a web view)
func openPopover() {
if let button = statusBarItem.button {
if !popover.isShown {
popover.show(relativeTo: button.bounds, of: button, preferredEdge: NSRectEdge.minY)
}
}
}
The popopver.show code gets executed, but, the popover never appears. Can’t see that I’m doing any obviously wrong things here. Anyone have any insight?