• 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: Retain count in non ARC
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Retain count in non ARC


  • Subject: Re: Retain count in non ARC
  • From: Ken Thomases <email@hidden>
  • Date: Sun, 06 Apr 2014 22:25:34 -0500

On Apr 6, 2014, at 9:18 PM, Graham Cox wrote:

> On 7 Apr 2014, at 10:35 am, Varun Chandramohan <email@hidden> wrote:
>
>> @property (retain) NSArray* contents;
>
> Should be:
>
> @property (copy) NSArray* contents;

> @synthesize contents = ivarContents;
>
> Having done that you'll now only have one ivar, the one you declared, and it will be associated with the property 'contents'. You won't need to write your own getter, but the setter should look something like:

Be careful.  If the property is atomic (i.e. not declared nonatomic) and you implement any of the accessors, then you have to implement them all to ensure they use the same synchronization scheme to achieve atomicity.  Usually, it's better/easier to simply declare the property nonatomic.

Regards,
Ken


_______________________________________________

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


  • Follow-Ups:
    • Re: Retain count in non ARC
      • From: Graham Cox <email@hidden>
    • Re: Retain count in non ARC
      • From: Varun Chandramohan <email@hidden>
References: 
 >Retain count in non ARC (From: Varun Chandramohan <email@hidden>)
 >Re: Retain count in non ARC (From: Graham Cox <email@hidden>)
 >Re: Retain count in non ARC (From: Graham Cox <email@hidden>)
 >Re: Retain count in non ARC (From: Varun Chandramohan <email@hidden>)
 >Re: Retain count in non ARC (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: NSOperation Issues
  • Next by Date: Re: Retain count in non ARC
  • Previous by thread: Re: Retain count in non ARC
  • Next by thread: Re: Retain count in non ARC
  • Index(es):
    • Date
    • Thread