Whilst learning Objective C I’ve gotten used to how the @property and @synthesize works.
//usual way
@synthesize world;
But recently I’ve come across practices were @synthesize is like this:
//new way
@synthesize world=world_;
Could someone explain why this technique is used please?
Thanks,
Mark
I believe this is used to avoid confusion between the actual ivar name and the property name.
so you can have
and then it makes it harder for you or some other developer working on this class to inadvertently access the ivar when you actually wanted the property or vice-versa. The different names make it clearer which is which.