Re: Objective 2.0 properties
Re: Objective 2.0 properties
- Subject: Re: Objective 2.0 properties
- From: "Ignacio Enriquez" <email@hidden>
- Date: Sat, 18 Oct 2008 12:47:35 +0900
Ken:
> I'm starting to think that you should avoid declared properties and dot
> syntax for now. With some of the newer features of Objective-C and Cocoa,
> it can be helpful for novices to first become proficient with the "old way"
> so they understand the details which are hidden by the "new way".
> In other words, perhaps you should get comfortable writing your own
> accessors instead of letting Objective-C synthesize them for you. And you
> should explicitly invoke them throughout your code, rather than blindly
> coding without understanding what's happening (with dot syntax, for
> example).
just to confirm...
(from http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_5_section_6.html#)
// assign
property = newValue;
// retain
if (property != newValue)
{
[property release];
property = [newValue retain];
}
// copy
if (property != newValue)
{
[property release];
property = [newValue copy];
}
So retain is more or less what I want. this means that instead of
writing getters and setter methods I can write
@property(retain) myproperty
and then in the implementation part
@synthesize myproperty
and I should have the same result to the above retain regarding code.
is this ok?
Thank you in advance.
Ignacio
_______________________________________________
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