Rewriting My Toy App in Swift
I’m not launching a new app. I wrote Staring eight(!) years ago.
Staring is a tiny app that prevents your Mac from sleeping. There are many like it, but this one is mine.
The rewrite was… uneventful. Swift saved me a lot of keystrokes, Xcode saved me even more. It suggested I rename NSTask
to Process
, so I did. There’s now a button
property in NSStatusItem
so I can delete my custom label class.
The whole thing is just 90 lines of code in one AppDelegate.swift file. You can check out the code if you want to use it as a starting point for your menu bar apps. Or download the app if you, too, like to have a ಠ_ಠ in your menu bar.