I am creating an OS X status bar application, so I want the application to start hidden.
I have created a \"storyboard\" application, and the initial wi
The way to do this is just like you tried:
let storyboard = NSStoryboard(name: "Main", bundle: nil)
guard let mainWC = storyboard.instantiateControllerWithIdentifier("MainWindowController") as? MainWindowController else {
fatalError("Error getting main window controller")
}
// optionally store the reference here
self.mainWindowController = mainWC
mainWC.window?.makeKeyAndOrderFront(nil) // or use `.showWindow(self)`
The only thing you probably forgot was to uncheck "Release when closed". This would immediately release the window and prevents the storyboard loading mechanism from finding it even if you had the right identifier.