Why do @synthesize variable names begin with an _?
Posted
by
mcjoejoe0911
on Stack Overflow
See other posts from Stack Overflow
or by mcjoejoe0911
Published on 2013-07-03T05:02:22Z
Indexed on
2013/07/03
5:05 UTC
Read the original article
Hit count: 69
objective-c
I'm just starting to use Objective-C and I need to clarify something
When I @synthesize a @property, it is common convention to do the following:
@interface Class : ParentClass
@property propertyName
@end
@implementation
@synthesize propertyName = _propertyName;
@end
I've seen plenty of questions and answers suggesting that "_propertyName" is widely accepted as the "correct" way to synthesize properties. However, does it serve ANY purpose? Or is it merely to increase readability and identify instance variables?
© Stack Overflow or respective owner