"Application is an agent" does not work in Swift

I am working on a status app in Swift. I tried to hide the window by adding an item Application is agent (UIElement)

and setting it to YES

, but it just doesn't work - it always shows the window and menu bar.

My storyboard:

enter image description here

Info.plist:

enter image description here

What can I do?

+3


source to share


1 answer


Customize your NSStatusBar with title, image, alternate image, etc. and you will see it in the system status bar.



    let statusItem = NSStatusBar.systemStatusBar().statusItemWithLength(NSVariableStatusItemLength)

    statusItem.button?.title = "LG"
    statusItem.button?.image = NSImage(named: "LGIcon")
    statusItem.button?.alternateImage = NSImage(named: "LGIcon")

      

0


source







All Articles