Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 10. Introspection > Exploring Properties

10.7. Exploring Properties

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.

Table 10.7. Common Formal Property Introspection Functions
FunctionReturns
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



  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint