The first one is only visible and acceseable from inside the implemented class. It is called an instance variable.
Whereas the property is visible to other classes as well. A property is backed by an iVar too. The @synthesize
is doing this behind the scenes. In your case the backing iVar would be accessable with the name of the property (e.g. simpleViewController
). But one should access a property via self (e.g. self.simpleViewController
) for simpler memory management and to distinguish it from an normal iVar. The @synthesize
will generate getter and setters to the iVar and will do memory management according to the property declaration (here retain).
Nowadays you do not even need a @synthesize
any more. Just declare a property. The compiler will create the property with an backing iVar with a prefix underscore. So one could access it either via self.simpleTableViewController
or via _simpleTableViewController
.