On 24 Jun 2014, at 3:38 am, Sean McBride <s...@rogue-research.com> wrote:
> 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? I interpret that to mean it must call a designated initializer *eventually*, not necessarily directly. Since all -initXXX methods of the superclass must call the superclass's designated initializer, your subclass's D.I. can call any of the superclass's -initXXX methods. --Graham _______________________________________________ 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