我想为 macOS 制作状态栏,但在我运行应用程序标题后显示并立即消失
func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
let statusItem = NSStatusBar.system().statusItem(withLength: NSVariableStatusItemLength)
statusItem.title = "Hello"
}
我认为引用有问题,但不知道如何解决这个问题。