What's the difference between @property and @synthesize?

后端 未结 4 938
难免孤独
难免孤独 2020-12-16 07:55

Like I understand, @synthesize actually is generating the Getters and Setters. But what\'s @property then doing? Is it just setting up the parameters for that cool @synthesi

4条回答
  •  天涯浪人
    2020-12-16 08:25

    @property declares the name as a property. This means, it will be accessible via the dot syntax (object.value).

    @synthetize can be seen as a macro, that creates the getter and setter methods. It is useful to know that you can override those methods, even if you type have the @synthetize in place.

提交回复
热议问题