Objective-C is @synthesize required or optional? Objective-C is @synthesize required or optional? ios ios

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;


Unless you've been using it like I have, then you still need it, as far as I can tell:

in .h:

@property int32_t FwdID;

in .m:

@synthesize FwdID;

usage inside class:

FwdID = 0;

From what I can tell, if you want the default to work for you, you'll have to type _FwdID = 0; in the code, which just looks ugly to me.

So if you are like me (breaking all the standard coding conventions I assume), you'll still need to use synthesize.