16
Developer Documentation

In the last chapter, I gave you some useful tidbits about the class NSArray. When you begin programming without my guidance (including taking on Challenges in this book), you will need to find such tidbits yourself. This is where Apple’s documentation comes in.

To see the documentation in Xcode, bring up the Organizer (click the Developer Documentation button at the top right of the Xcode window) and choose the Documentation tab.

Figure 16.1  Docs in the Organizer

Docs in the Organizer

There are essentially five types of documentation that Apple provides:

  • References: Every Objective-C class and every C function is tersely documented in these pages.

  • Guides and Getting Starteds: Guides are less terse and group ideas conceptually. For example, there is an Error Handling Programming Guide that describes the myriad of ways that Mac and iOS developers can be informed that something has gone wrong.

  • Sample Code: These are small, complete projects that demonstrate how Apple expects its technology to be used. For example, there is a WeatherMap project that shows how to make custom annotations on iOS map views.

  • Release Notes: Every time a new version of Mac OS or iOS comes out, it is accompanied by a set of release notes. The release notes tell developers what has changed since the last version.

  • Technical notes, Articles, Coding How-to’s, and Technical Q&As,: These are bite-sized documents that address specific issues.

You can browse the documentation, but there is a lot of it. More commonly, you will access the documentation via search.

Reference pages

At the top of the lefthand pane in Organizer, click the Reference pages button to bring up the search panel. Type NSArray into the search field, and the search results will appear below the search field. In the Reference section, click on NSArray to see the reference page for NSArray.

Figure 16.2  NSArray reference page

NSArray reference page

It would be difficult to overstate how important these reference pages will be to you and how important they are for programmers of all levels. Apple has worked really hard to create huge libraries of code for your convenience. You will learn about these libraries primarily through reference pages. As you go through this book, take a moment to look up the reference pages for new classes as you use them and see what else they can do. You can also search for methods, functions, constants, and properties by name. (You’ll learn about properties in Chapter 17.) The more comfortable you get using these pages, the faster your development will go.

At the top of the class reference for NSArray, you can learn several things about the class. It inherits from NSObject. (More about this soon in Chapter 18.) It conforms to several protocols (which we’ll discuss in Chapter 25). It is part of the Foundation framework and has shipped with every version of Mac OS X and every version of iOS.

At the end of the header, there is a list of guides that discuss NSArray and sample code that shows off the capabilities of NSArray. Click on Collections Programming Topics to open that guide.

Figure 16.3  Collections Programming Topics

Collections Programming Topics

This particular guide discusses the collection classes (including NSArray and NSMutableArray). Unlike the class reference, a guide is a pleasant read, in which ideas are introduced in a sensical order.

Now use the back button at the top of the document pane to go back to the NSArray reference page. Curious about what other messages you can send to an NSArray? Scroll down the reference page and find the list of methods that NSArray implements. Say you’re looking for a way to check if an array contains a particular item. In that case, you’d run across the containsObject: method and read its description:

Figure 16.4  Reference for containsObject:

Reference for containsObject:

Now you know everything you need to know to send this message in your code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset