1. Properties typically refer to certain data that is encapsulated or stored by an object. It can be a flag (such as a name or color), or it can be a relationship to one or more other objects.
2. The basic declaration of a property uses the @property
compiler directive, followed by the type information and name of the property. You can also use custom options to configure properties to define how the access method behaves, whether the property is a weak reference, and whether it is read-only.
3.
If you want instance variables to have different names, you can bypass auto-compositing and explicitly synthesize attributes. Use compiler directives in the class implementation to have the @synthesize
compiler generate access methods, as well as special named instance variables. For example:
@synthesize enabled = _isenabled; |
Simply put, @synthesize's role is to redefine the attribute variables you create automatically when you define attributes in the interface section of the implementation section.
The definition of attributes and the use of @synthesize