I'm trying to add an item to the status bar, but when I launch the app the item only appears in the top left for a split second and then quickly disappears.
I've looked through the documentation and I can see things have changed recently e.g. statusItem.title
has become statusItem.button?.title
. But don't seem to be missing anything else. Any help?
Here's my code:
var statusItem : NSStatusItem? = nil
func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
statusItem.button?.title = "Connect!"
}