How do I call a function in my ViewController from my NSWindow?

I am using Swift and Storyboards. I cannot figure out how to access my ViewController from my NSWindow. The storyboard doesn't seem to allow me to create an outlet from one to the other. I'm sure there is an easy way to do this.

Edit: why is this not possible?

enter image description here

+3


source to share


1 answer


From my NSWindow, I was able to access the NSViewController like this:

let controller = self.windowController()?.contentViewController as! ViewController;

      



where ViewController

is the name of my ViewController subclass NSViewController.

It's still not clear to me why I can't just create an Outlet using a storyboard.

+4


source







All Articles