Re: Properties vs Instance Variables
Re: Properties vs Instance Variables
- Subject: Re: Properties vs Instance Variables
- From: Matt Neuburg <email@hidden>
- Date: Wed, 27 Apr 2011 08:52:14 -0700
On Tue, 26 Apr 2011 21:23:10 -0700, Kyle Sluder <email@hidden> said:
>On Tue, Apr 26, 2011 at 9:07 PM, Steve Christensen <email@hidden> wrote:
>> I believe it's only necessary if you want to do a straight "@synthesize foo;", which would expect the instance variable to have the same name as the property.
>
>And it's worth mentioning that you can always do @synthesize foo=_foo;
>to map a property to an ivar with a different name.
And Apple now exemplifies this pattern, e.g. in the app template for Window-based Application: there's a "window" property accessing a "_window" ivar. I think they do this just so you can't accidentally say "window" unqualified. m.
--
matt neuburg, phd = email@hidden, <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook_______________________________________________
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