I am using an iOS5 book to learn iOS programming.
@synthesize coolWord;
^synthesize is used for all properties in .m files
I heard that in iOS6 there is no need for synthesize, since it is automatically done for you. Is this true?
Does synthesize play any role for iOS6?
Thanks for the clarification. 🙂
@synthesize in objective-c just implements property setters and getters:
It is true with Xcode 4 that this is implemented for you (iOS6 requires Xcode 4). Technically it implements
@synthesize coolWord = _coolWord(_coolWordis the instance variable andcoolWordis the property).To access these properties use
self.coolWordboth for settingself.coolWord = @"YEAH!";and gettingNSLog(@"%@", self.coolWord);Also note, both the setter and getter can still be manually implemented. If you implement BOTH the setter and getter though you NEED to also manually include
@synthesize coolWord = _coolWord;(no idea why this is).