I want to initialize a window controller object from a nib file, quite easy right? But I simply can't get it to work.
According to my previous experience in ObjC, I've written down the following code:
init() {
super.init(windowNibName: "SplitWindowController")
}
And in the app delegate file, I simply init and displays the window:
var myWindowController: MyWindowController = MyWindowController()
myWindowController.showWindow(self)
myWindowController.window.makeKeyAndOrderFront(nil)
But the compiler gives me this error: Must call a designated initializer of the superclass 'NSWindowController'
. And according to the Swift version of NSWindowController
definition, there are only 3 designated initializers, namely init()
, init(window)
, init(coder)
. I don't know what to do next. Shall I build a NSCoder
from a nib file, which I don't know how to do?