Hi Rick,
According to the latest documentation pack that arrived on Thursday, Swift has: convenience init(windowNibName windowNibName: String, owner owner: AnyObject) So just use this. Like C++, Swift has overloaded method names, so 'init' can take various parameter combinations. Also, in general I think what you're saying about designated initializers is incorrect - the designated initializer MUST be called, but not necessarily by you. All it means is that the other init... methods must call it. The guideline about it being the one with the most parameters is not a rule - typically that's true but it's not a requirement and for many classes, definitely not true. --Graham On 19 Oct 2014, at 2:08 pm, Rick Mann <rm...@latencyzero.com> wrote: > 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? _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com