TOP KEK
TOP KEK

Reputation: 2651

Why @synthetize has to be added manually?

When I declare a @property it is obvious that I would like to use it later. For some reasons declaring @property is not enough and I have to tell compiler to @synthetize it in every .m file. Because of this every .m file in my projects starts with @synthetize.

Why they did not do it in a C# way, where just declaration is enough and compiler do the rest?

Upvotes: 1

Views: 544

Answers (2)

hburde
hburde

Reputation: 1441

You get standard Accessors almost for free and its possible to roll your own Getters / Setter if necessary.

Upvotes: 0

Greg Hewgill
Greg Hewgill

Reputation: 992995

By making @synthesize optional, you are free to implement your getter and setter methods in any way you choose.

You can find more information in Apple's Declared Properties documentation, particularly the section titled "Property Implementation Directives".

Upvotes: 4

Related Questions