Re: self = [super init], nil?
Re: self = [super init], nil?
- Subject: Re: self = [super init], nil?
- From: Scott Anguish <email@hidden>
- Date: Sun, 9 May 2010 22:56:46 -0400
This has been, or is being updated.
The suggested pattern is now
- (id)init
{
self = [super init];
if (self)
{
}
return self;
}
All our documentation has been updated to reflect this (even if it hasn’t necessarily made it out to the users yet)
On May 8, 2010, at 11:27 AM, jeremy wrote:
> On May 7, 2010, at 2:34 PM, Patrick M. Rutkowski wrote:
>
>> it worth checking for nil after doing self = [super init]?
>
>
> Yes. It's part of a design pattern, which looks like this:
>
> ---
> - (id)init
> {
> if (self = [super init])
> {
>
> }
> return self;
> }
> ---
>
> See "Constraints and Conventions".
> http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocAllocInit.html#//apple_ref/doc/uid/TP30001163-CH22-SW14
>
> Also see "Handling Initialization Failure".
> http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocAllocInit.html#//apple_ref/doc/uid/TP30001163-CH22-SW13
_______________________________________________
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