Explore the runtime system.
The Objective-C runtime library exposes all of the dynamic features of Objective-C through a clean set of C interfaces. This is used to implement features of Cocoa like key-value coding and observing as well as the call-by-name methods in NSObject. Sometimes you can save a lot of code by calling a few of the runtime functions. For example, you can avoid the need for bundles to register plugins by enumerating all of the classes that implement a specified protocol.
For more tips, and more detail about this tip, please see my new book,
Cocoa Programming Developer's Handbook,
available in print and electronic formats.
Take advantage of special member promotions, everyday discounts, quick access to saved content, and more! Join Today.