All this...
class AppDelegate: NSObject, NSApplicationDelegate { @IBOutlet var window: NSWindow
I just copied it from your link and translated it to Swift. It still shows a window, etc. Which should be trivial to remove ... UPDATE showed how ...
(and of course I run it on Yosemite)
source share