I know that it is possible in Objective C to define an instance variable without a property when I use curly braces in the top of the interface or the implementation. But what is the advantage when I do that?
Asked
Active
Viewed 113 times
0
-
Don't look for advantages. It's archaism of objective-c. – Cy-4AH Oct 28 '14 at 11:35
2 Answers
0
I think your question should be comparing to property what is the advantage of defining instance variables.
Most property is backed by a instance variables. By default, a readwrite property will be backed by an instance variable, which will be synthesized automatically by the compiler. (A readonly property won't synthesize an instance variable, it only synthesizes a getter method which a readwrite property synthesize an instance variable and a getter and a setter method)
So property provides methods that synthesized by compiler to access the instance variable. I can't say which one has any advantages, just use the one which is proper to your case.
You may need to learn more about property. Properties Encapsulate an Object’s Values

KudoCC
- 6,912
- 1
- 24
- 53