Notes: This document uses “Cocoa” generically when referring to things that are common between the
platforms. When it is necessary to say something specific about Cocoa on a given platform, it uses a phrase
such as “Cocoa on Mac OS X.”
For detailed descriptions of the components in the layers of iOS, see iOS Technology Overview.
As with Cocoa on Mac OS X, the programmatic interfaces of Cocoa on iOS give your applications access to
the capabilities of underlying technologies. Usually there will be a Foundation or UIKit method or function
that can tap into a lower-level framework to do what you want. But, as with Cocoa on Mac OS X, if you require
some capability that is not exposed through API, or if you need some finer control of what happens in your
application, you may choose to use an underlying framework directly. For example, UIKit uses the Web Kit
to draw text and publishes some methods for drawing text; however, you may decide to use Core Text to
draw text because that gives you the control you need for text layout and font management. Again, using
these lower-level frameworks is not a problem because the programmatic interfaces of most dependent
frameworks are written in standard ANSI C, of which Objective-C language is a superset.
Further Reading: To learn more about the frameworks, services, and other aspects of the iOS platform, see
iOS Technology Overview.
Features of a Cocoa Application
On Mac OS X it is possible to create a Cocoa application without adding a single line of code. Make a new
Cocoa application project using Xcode and then build the project. That’s it. Of course, this application won’t
do much, or at least much that’s interesting. But this extremely simple application still launches when
double-clicked, displays its icon in the Dock, displays its main menu and window (entitled “Window”), hides
itself on command, behaves nicely with other running applications, and quits on command. You can move,
resize, minimize, and close the window. You can even print the emptiness contained by the window.
You can do the same with an iOS application. Create a project in Xcode using one of the project templates,
immediately build it, and run it in the simulator. It quits when you click the Home button (or press it on a
device). To launch the application, click its icon in the simulator. It may even have additional behaviors; for
example, with an application made from the Utility Application template, the initial view "flips” to a second
view when you click the information (“i”) icon.
Imagine what you could do with a little code.
iOS Note: The features and behavior of an application running on iOS are considerably different from a Mac
OS X application, largely because it runs in a more constrained environment. For discussions of application
capabilities and constraints on iOS, see iOS Application Programming Guide.
In terms of programming effort, Cocoa gives you, the developer, much that is free and much that is low-cost.
Of course, to become a productive Cocoa developer means becoming familiar with possibly new concepts,
design patterns, programming interfaces, and development tools, and this effort is not negligible. But
familiarity yields greater productivity. Programming becomes largely an exercise in assembling the
programmatic components that Cocoa provides along with the custom objects and code that define your
program’s particular logic, then fitting the whole assemblage together.
What follows is a short list of how Cocoa adds value to an application with only a little (and sometimes no)
effort on your part:
20
Features of a Cocoa Application
2010-11-15 | © 2010 Apple Inc. All Rights Reserved.
CHAPTER 1
What Is Cocoa?