Re: There's obviously something I don't understand about NSDate.
Re: There's obviously something I don't understand about NSDate.
- Subject: Re: There's obviously something I don't understand about NSDate.
- From: Charles Srstka <email@hidden>
- Date: Sat, 17 Mar 2012 22:14:46 -0500
On Mar 17, 2012, at 7:19 PM, Eeyore wrote:
> I believe you were also on the discussion of properties vs. direct ivar access. This ties into that discussion. If you declare/define a property with:
>
> @property (nonatomic, retain) NSDate* firstBadAccuracyTime;
>
> If you are using ARC, the property would be
>
> @property (nonatomic, strong) NSDate* firstBadAccuracyTime;
One thing to add is that if your property is a type of object for which there exists a mutable variant — NSString, NSArray, etc. — then you should use copy instead of retain/strong. For immutable objects, this will just do a retain anyway, so no harm no foul, but if someone passes, say, an NSMutableString to your property, you’d want to make an immutable copy of it so that the value wouldn’t change under your feet.
Charles
_______________________________________________
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