• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: initWithCoder: calling init in custom class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: initWithCoder: calling init in custom class (From: Trygve Inda <email@hidden>)

  • Prev by Date: Re: initWithCoder: calling init in custom class
  • Next by Date: NSCoding vs NSSecureCoding
  • Previous by thread: Re: initWithCoder: calling init in custom class
  • Next by thread: NSCoding vs NSSecureCoding
  • Index(es):
    • Date
    • Thread