On 30 Jul 2015, at 11:03 AM, Trygve Inda <cocoa...@xericdesign.com> wrote:
> It seems Apple is using retain rather than copy for NSString properties in > an NSManagedObject subclass. > > I was always under the impression that copy should be used for NSString, so > why the retain?? For an immutable string, -copy is implemented as a -retain. -copy is a guard against the receiver’s relying on the unchanging contents of a string whose contents can be changed. If the contents cannot in fact be changed, there’s no point in allocating new memory and copying the bytes into it. It’s an implementation detail; what makes you believe it makes a difference? — F _______________________________________________ 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