What I usually do is:
- create a class I call Global, that has a singleton
class Global {
class var shared : Global {
struct Singleton {
static let instance = Global()
}
return Singleton.instance;
} // shared
// Reference to controllers
var otherController : NSWindowController? // In fact, must be the class you declared for the windowController
When I load the other class, I set it in didLoad:
Global.shared.otherController = self
Now I can use it as needed in first controller (just care for nil with conditional ?)
Global.shared.otherController?.close() // I think you dont need Global.shared.otherController>.window.close()