Re: NSWindowController and designated initializer rules
Re: NSWindowController and designated initializer rules
- Subject: Re: NSWindowController and designated initializer rules
- From: Keary Suska <email@hidden>
- Date: Mon, 23 Jun 2014 18:08:42 -0600
On Jun 23, 2014, at 11:38 AM, Sean McBride wrote:
> Hi all,
>
> The Obj-C designated initializer rules say that if a subclass creates a new designated initializer that its implementation must call (one of) the superclass' designated initializer.
>
> The docs for NSWindowController say initWithWindow: is the (only) designated initializer.
>
> Countless examples of NSWindowController subclassing, like Apple's Sketch sample code:
>
> <https://developer.apple.com/library/mac/samplecode/Sketch/Listings/SKTWindowController_m.html>
>
> do this:
>
> - (id)init {
> // Do the regular Cocoa thing, specifying a particular nib.
> self = [super initWithWindowNibName:@"DrawWindow"];
> }
>
> So there seems to be a contradiction here... Are the docs just omitting that initWithWindowNibName: is in fact a secondary designated initializer?
My understanding of Objective-C convention rules is that *every* initializer *should* call the designated initializer, and that the API follows this convention, unless documented otherwise...
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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