@synthesize


#1

I have been watching the videos from the Stanford iOS programming course. In that course, the instructor uses the following syntax for synthesize

@synthesize propertyValue = _propertyValue

However, I noticed that the authors here do not follow this method. Which is correct, or better to use?


#2

Both methods are correct; however, specifying explicitly the backing variable for the property will help in avoiding potential name conflicts.


#3

In the current version of Objective-C, @synthesize is implied and it automatically creates a variable with an underscore in front of it. Therefore, you don’t need to type anything but the property declaration anymore.


#4

Thanks Joe and ibex. Seems like iOS changes so fast it’s hard to keep current.