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

> On 7 Apr 2014, at 10:35 am, Varun Chandramohan 
> <varun.chandramo...@wontok.com> 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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to