I added a menu bar icon that opens a popover. It works ok but when I close the app via the red cross and try to open the app again with a click on the dock icon it opens the application window (as it should) but also the menu bar popover (which it should not). How can I only open the application window and not the popover when I click on the dock icon? My code that handles the opening of when clicking the dock icon looks like this:
func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
if !flag {
for window: AnyObject in sender.windows {
window.makeKeyAndOrderFront(self)
}
}
return true
}