Subclassing NSWindowController in Swift
Subclassing NSWindowController in Swift
- Subject: Subclassing NSWindowController in Swift
- From: Rick Mann <email@hidden>
- Date: Sat, 18 Oct 2014 20:08:01 -0700
In Obj-C, I typically subclass NSWindowController and override -init to call -initWithNibName:. I do this so the caller doesn't have to worry about how to make one of these window controllers:
@implementation MyWindowController
- (id) init
{
self = [super initWithWindowNibName: "MyWindow" owner: self]
...
return self;
}
I can't figure out how to do the same in Swift. NSWindowController makes initWithWindow() the only designated initializer, which I must call, which makes it seem like I can't use any of the convenience methods. Apple's own guidance on designated inititalizers is that they should be the ones that take the most parameters.
So, I can load the nib myself, and make the window, and pass that up, but this seems broken. Is it?
--
Rick Mann
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden