Info.plist:
LSUIElement = YES
AppDelegate.swift:
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
let statusMenu: NSMenu = .init()
let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength)
func applicationDidFinishLaunching(_ aNotification: Notification) {
statusItem.button?.image = NSImage.init(named: NSImage.actionTemplateName)
statusItem.menu = statusMenu
let quitMenuItem: NSMenuItem = .init(title: "Quit", action: #selector(quit), keyEquivalent: "")
statusMenu.addItem(quitMenuItem)
}
@objc func quit() {
NSApp.terminate(self)
}
}
Остальное как в курсах.