I create a simple app for only status bar in macOS Swift.
I create a new NSWindowController and xib, when I call @objc function
self.aboutWindows.showWindow(self)
if I click it opens, but every time I click it opens a new window. How can I avoid it.
Same for another function of an NSMenuItem, I would like to start it only once.
Thanks
EDIT:
ALL IN APPDELEGATE
var aboutWindows = AboutWindows()
...
//TAP ON MENU ITEM
@objc func aboutWindows(_ sender: Any) {
aboutWindows = AboutWindows(windowNibName: "AboutWindows")
self.aboutWindows.showWindow(self)
}