On Jan 20, 2011, at 4:46 PM, Nick Zitzmann wrote:

> 
> On Jan 20, 2011, at 5:25 PM, Philip Vallone wrote:
> 
>> Currently, my NSManagedObjectContext is retained like this in my app 
>> delegate:
>> 
>> @property (nonatomic, retain, readonly) NSManagedObjectContext 
>> *managedObjectContext;
> 
> If you have declared the property to be read-only, then the retain keyword is 
> not necessary. Retain and assign are only necessary if it's a read/write 
> property, since they tell the synthesizer what to do with new values (if 
> @synthesize is in use).

I'm somewhat new to all this also, so perhaps I'm off on this one. My 
understanding is that using (retain, readonly) in the class interface insures 
that if the property is ever changed to readwrite in a category, then it must 
be (retain, readwrite) and not (assign, readwrite) or (copy, readwrite). 
Whether this guarantee is important or not probably depends on the 
circumstances, but there is extra information the compiler can use to catch 
errors when you declare it as (retain, readonly) that isn't available when you 
declare it as (readonly).

Aaron

_______________________________________________

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

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

Reply via email to