Re: initWithCoder: calling init in custom class
Re: initWithCoder: calling init in custom class
- Subject: Re: initWithCoder: calling init in custom class
- From: Quincey Morris <email@hidden>
- Date: Mon, 16 Jun 2014 13:45:17 -0700
On Jun 16, 2014, at 13:36 , Trygve Inda <email@hidden> wrote:
> In the later method, if the encoded object does not contain kValueCKey, the
> object created will still have the correct default value for valueC (9).
It won’t, because you assigned nil to valueC *after* it’s set to the default.
Personally, I’d be inclined to have initWithCoder call super, because in more complicated examples the logic tends to be quite different. If you have common initialization (such as the initial setting of defaults), put them in a private method that both initializers call.
_______________________________________________
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