1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

@property ?

Discussion in 'Mac Programming' started by iFaisal, Apr 22, 2011.

  1. macrumors newbie


    hello everyone ,

    what is the different between set/get function and @property/@synthesize ?

    is it just syntax code or not ? and what does mean ?
  2. macrumors G5


    The Objective-C 2.0 language manual on Apple's web site will answer all these questions. And playing around with styles like you did is _very_ impolite.
  3. macrumors 6502a


    synthsize sets up its own get/set methods
  4. macrumors 65816


    At first we had to code our own getters and setters. There was no concept of a property in Objective-C 1.0, except by the convention that if a class had a method x and a method setX: then it could have been said to have property x.

    Then Apple created Objective-C 2.0 and it introduced the @property and @synthesise directives, as well as the dot notation. And the number of getters and setters we had to write was reduced to near zero. And our getters and setters become correct in the face of concurrency (assuming no nonatomic) which set us up well for the days of multicore CPUs and GCD.

    And the people programming in the land of Apple were happy. (Well generally, some have some valid objections to dot notation).

    So yeah, it's just syntax. But I'd highly recommend you use it, unless you have strong reasons not to.
  5. macrumors newbie

    thank you everyone ... I'm understanding now what is the different . :)

Share This Page