• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Objective 2.0 properties
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Objective 2.0 properties
      • From: Ken Thomases <email@hidden>
References: 
 >Objective 2.0 properties (From: "Ignacio Enriquez" <email@hidden>)
 >Re: Objective 2.0 properties (From: Charles Steinman <email@hidden>)
 >Re: Objective 2.0 properties (From: "Ignacio Enriquez" <email@hidden>)
 >Re: Objective 2.0 properties (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Implementing a KVO/Bindings-Compliant Bridge-Pattern in Cocoa
  • Next by Date: Re: Screen not redrawing
  • Previous by thread: Re: Objective 2.0 properties
  • Next by thread: Re: Objective 2.0 properties
  • Index(es):
    • Date
    • Thread