I know that, for iOS, you can reference the root view controller from the app delegate like so:
var rootViewController = self.window!.rootViewController
How does one reference the main window controller from the app delegate when targeting OS X? I would like to pass a variable (the managed object context) this way, as I have read that it is a good solution for referencing the moc.
You can access the NSWindowController instance of the main NSWindow like this:
NSApplication.sharedApplication().mainWindow?.windowController
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With