Re: initWithCoder: calling init in custom class
Re: initWithCoder: calling init in custom class
- Subject: Re: initWithCoder: calling init in custom class
- From: Scott Ribe <email@hidden>
- Date: Mon, 16 Jun 2014 16:32:35 -0600
On Jun 16, 2014, at 4:24 PM, Trygve Inda <email@hidden> wrote:
> I guess the only way to prevent this is to check to see if
>
> [coder decodeObjectForKey:kValueAKey]
>
> returns non-nil before assigning it to valueA.
Well, if you're not afraid of terse idioms and GCC extensions, you can avoid all the hooha of a temporary variable and if statement:
valueA = [coder decodeObjectForKey:kValueAKey] ?: valueA;
--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
(303) 722-0567 voice
_______________________________________________
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