Examples

This section contains examples that use the Objective-C runtime to obtain detailed information about the objects in an application. None of the examples are complete. They each show just enough to illustrate how to perform a certain task using the runtime. The examples need to be incorporated into larger Cocoa applications to be of any practical use.

Get a List of All Classes

The MYShowAllClasses() function, in this example, prints the name of every class linked to a Cocoa application. Call this function from within a Cocoa application that is run in Project Builder or from a Terminal to see the output. This function can be trivially modified to return an NSArray containing the NSString names of all classes linked into an application. ...

Get Cocoa® Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.