Given the following class def:
@interface MyController : OtherController {
NSString *_ID;
}
@property(nonatomic,retain) NSString *ID;
@end
and the following implementation:
@implementation DRMControllerNDS
@synthesize ID =_ID;
@end
What is the @synthesize statement doing here? Specifically why are we are setting the _ID instance variable value to the ID property? Isn’t _ID going to be nil at this point in execution? I have seen this construct used many times and am yet to understand its purpose…
Can anyone explain this?
In plain English, the @synthesize line says “Create the getter and setter methods for the property “ID”, but don’t use an instance variable called “ID” (the default) to store the value, use an instance variable called “_ID” instead.”