Re: NSArray, NSDictionary property attribute issue, retain or copy?
Re: NSArray, NSDictionary property attribute issue, retain or copy?
- Subject: Re: NSArray, NSDictionary property attribute issue, retain or copy?
- From: mwalker <email@hidden>
- Date: Mon, 14 Nov 2011 05:40:59 +0000 (GMT)
I always think of the difference between using copy or retain for a @property as the difference between wanting the *value* or wanting the *object*. For a user's name, for example, you want to name, not the object that contains the name, so use copy. For a mutable string you want to simply know what it contains at any given time, use retain.
For example, an NSOperationQueue property should use retain because you want to use the queue itself.
While it's not always true, for NSObject-subclass-type properties, use copy if you want the value, use retain for everything else.
Mel
_______________________________________________
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