could not explain with simple words, in what situations are Synthesize? I understand it, it makes it possible to referred via GET and SET-. It turns out that properi without synthesis does not differ from the class variable? And then does it even make sense to write proputations without Synthesize?
Answer 1, Authority 100%
Property (Property) appeared in Objective-C only in version 2.0 and they are reduced to conventional methods (or messages, if any). That is if you declare the property
@ property (nonatomic, retain) nsstring * property1;
In fact, you are declared such a getter and setter:
- (nsstring *) property1; - (void) setProperty1: (nsstring *) value;
When you use the property
nsstring * p = v.property1; v.Property1 = P;
In fact, the compiler “unfolds” is in such a code:
nsstring * p = [v property1]; [v setProperty1: p];
@synthesize property1; operator is deployed in the code definition for the setter and the getter (in accordance with the parameters that you specified in the property declaration).
You can not write
@synthesize , but in this case you will have to write the realization of the getter and setter yourself. If you do not make any other, the compiler will give a warning, and the code that uses the property will take out.
@Property Develops in Setter and Getter, it needs to be written in the class interface (usually in the header file – .h). Similarly,
@synthesize “generates” Setter and Getter implementations, so used in the implementation file (.m, .mm).
Answer 2, Authority 24%
From the question “Objective-C is @synthesize Required or Optional? “:
No We Don’t Need To Do That As of Xcode 4.4, Which Added A Feature Called Default Synthesis Of Properties.
Simply Put, It Generates This Automatically:
@ synthesize name = _name;
In short, you can not steam: Starting with Xcode 4.4, IDE itself default sets
@synthesize name = _name; Wherever it is required.