Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
In Objective-C 2.0, the @property directive attaches metadata to the class that is available to the programmer at runtime. These are called formal properties. Naturally, the set of properties will overlap instance variables and methods, since most properties are implemented using instance variables along with getter and setting methods. Table 10-7 lists the common methods for examining the formal properties of a class.
| Function | Returns |
|---|---|
| class_copyPropertyList(Class,unsigned int *) | NULL-terminated array of objc_property_t structure pointers |
| protocol_copyPropertyList(Protocol*,unsigned int *) | NULL-terminated array of objc_property_t structure pointers |
| class_getProperty(Class,const char*) | objc_property_t structure for a named property |
| protocol_getProperty(Protocol*,const char*,BOOL,BOOL) | objc_property_t structure for a named property |
| property_getName(objc_property_t) | name of property |
| property_getAttributes(objc_property_t) | attribute string that describes the property |