Learning Cocoa with Objective-C/Appendixes/Using the Foundation and Application Kit API References

From WikiContent

Jump to: navigation, search
Learning Cocoa with Objective-C

When you install Apple's developer tools on your system, a set of reference documents is installed with them into the /Developer/Documentationfolder on your hard drive. This documentation covers all aspects of Mac OS X development, from building kernel extensions to Carbon and Cocoa development. For Cocoa development, the place to start looking is in the /Developer/Documentation/Cocoafolder, as shown in Figure C-1.

Figure C-1. The location of the Cocoa Developer Documentation

The location of the Cocoa Developer Documentation

Simply double-click the CocoaTopics.html file, and your browser will open it, showing you the complete set of Cocoa documentation. While using this book, one of the most important parts of this documentation set will be the Objective-C Framework Reference, highlighted in Figure C-2.

Figure C-2. Cocoa Developer Documentation index page

Cocoa Developer Documentation index page

The Objective-C Framework Reference consists of four primary sections:

Application Kit Reference
The authoritative and comprehensive reference to all of the classes, protocols, functions, and types in the Application Kit.
Foundation Reference
The authoritative and comprehensive reference to all of the classes, protocols, functions, and types in the Foundation Kit.
Application Kit Release Notes
An overview of the changes to the Application Kit in the last release. With each release of Mac OS X comes new features and functionality. This document details the changes in the AppKit that will affect you. You should read these to keep on top of new developments.
Foundation Release Notes
An overview of the changes to the Foundation Kit in the latest release.

The benefit to this reference set is that it will always be there, even if you are hacking Cocoa on your PowerBook at 38,000 feet above the Atlantic Ocean. However, the shear mass of documentation on the system can be intimidating to use.

Cocoa Browser

When writing this book, we were planning on putting in quick references to the Foundation and Application Kit APIs as a couple of long appendixes. We thought a bit about the best way to organize the information and came up with a few solutions that might have worked. Then we stumbled across Cocoa Browser, an Open Source documentation viewer written by Hoshi Takanori and Max Horn. It was good enough, even at version 0.4, to recommend as a replacement for the 50 or more pages of reference that would quickly become dated in this book (not to mention that including that many pages would probably drive up the price of the book).

Cocoa Browser presents an effective column-based interface—similar to the Finder's column view—to the documentation installed in your /Developer/Documentation /Cocoafolder. This column view allows quick access to the information you need. In Figure C-3, we've drilled through to the init method of NSObject and can view the documentation for this method directly.

Figure C-3. Using Cocoa Browser to access API reference documentation

Using Cocoa Browser to access API reference documentation

Cocoa Browser is also invaluable for seeing which methods a particular class supports and which arguments can be used. For example, we find ourselves looking at all the methods that NSResponder and its subclasses support on a frequent basis. In addition, the Cocoa functions and data types from both the AppKit and the Foundation Kit are easily browsable, as shown in Figure C-4.

Figure C-4. Browsing Foundation's functions

Browsing Foundation's functions

You can find Cocoa Browser at the following URL:

http://homepage2.nifty.com/hoshi-takanori/cocoa-browser

Since the tool is Open Source and licensed under the GPL, it will always be available for use and can't just disappear. If, for some reason, this site goes away, we'll be sure to link to where you can pick up this tool from the web site for this book:

http://www.oreilly.com/catalog/learncocoa2

Personal tools