Hey, I'm creating an NSStatusItem but I can't access the button, it crashes if I unwrap it.
import Cocoa
func main() {
let delegate = AppDelegate()
let app = NSApplication.shared
app.delegate = delegate
app.setActivationPolicy(.prohibited)
app.run()
}
final class AppDelegate: NSObject, NSApplicationDelegate {
var item: NSStatusItem!
func applicationDidFinishLaunching(_ aNotification: Notification) {
item = NSStatusItem()
item.behavior = [.removalAllowed, .terminationOnRemoval]
item.button!.image = NSImage(named: "circle.fill") // Crashes here
}
}