Cocoa helps you create commercial-grade applications quickly and efficiently. It is an advanced, mature object-oriented development environment that enables you to create complex software with surprisingly few lines of code. Through a seamless integration of tools and Cocoa API, the design and construction of a user interface is largely a matter of dragging windows, buttons, and other objects from palettes, initializing their attributes, and connecting them to other objects. Cocoa also defines a model for applications and implements most aspects of application behavior; you simply fit into this model the code that makes your application unique. The programmatic interfaces of the core Cocoa frameworks, Foundation and Application Kit, simplify access to most of the technologies on which Mac OS X is based, such as Quartz, Bonjour networking, Core Text, and the printing system. Although these interfaces are in Objective-C, you can integrate code written in other languages into your Cocoa projects, including C++ code and C code. Because Objective-C is a superset of ANSI C, frameworks with C APIs are compatible with Objective-C. If you haven’t already done so, glance through the Cocoa Reference Library to get an idea of the information that is available.
You should first have a working knowledge of the C language and you should be familiar with basic programming constructs. Then, before you write a line of code, become familiar with the Cocoa environment by reading:
What Is Cocoa? in Cocoa Fundamentals Guide if you want to quickly gain a basic understanding of the architecture, capabilities, frameworks, and development tools of Cocoa.
Developing Cocoa Objective-C Applications: A Tutorial and Cocoa Application Tutorial Using Bindings to get an idea of what Cocoa development is like.
A third-party introductory book on Cocoa programming such as Cocoa Programming for Mac OS X by Aaron Hillegass (published by Addison-Wesley Professional and available through Amazon). These books not only include overviews of Cocoa, but can be valuable resources in the later stages of learning.
If you have the time, read all of Cocoa Fundamentals Guide for an orientation to Cocoa software development, including the basic concepts, terminology, design patterns, and architectures.
To obtain the tools and other resources necessary for Cocoa programming, go to the Mac Dev Center.
Becoming a productive Cocoa programmer begins with becoming familiar with the languages, tools, and programming interfaces. After that, you might want to integrate an existing code base into a Cocoa application.
The first step toward Cocoa development is learning the concepts of object-oriented programming and Objective-C, the simple yet powerful object-oriented programming language in which Cocoa is implemented:
If you are unfamiliar with object-oriented programming, read Object-Oriented Programming with Objective-C. You can also find many books on object-oriented programming in technical bookstores.
If you want to learn Objective-C, including recently added features such as properties and garbage collection, read The Objective-C Programming Language.
If you want to better understand the object-oriented capabilities of Cocoa, peruse Cocoa Objects in Cocoa Fundamentals Guide, which discusses such issues as object creation, the object life cycle, and basic object capabilities and behavior.
If you want to learn how to use a Cocoa framework and how to make a subclass, see Adding Behavior to a Cocoa Program in Cocoa Fundamentals Guide.
If you want to find out what the development cycle is like and how the tools work together, start with Understanding Xcode Projects and then read A Tour of Xcode. Xcode is the name of both Apple’s integrated development environment and the application used for managing, building, and debugging projects. Also take a look at Mac OS X Technology Overview to learn more about the development tools that you use to create, build, debug, and fine-tune Cocoa programs.
If you want to know more about constructing user interfaces, read Interface Builder. The online help for the Interface Builder application also contains helpful information.
The core frameworks of Cocoa, Foundation and Application Kit, consist of hundreds of Objective-C classes and thousands of methods. To make this large API more approachable, Apple provides dozens of programming guides, overviews, and other documents. Beginning Cocoa programmers will want to read some of the following recommended documents:
If you want to learn about the value classes, which are essential for all types of Cocoa programs, read String Programming Guide for Cocoa, Collections Programming Topics for Cocoa, Binary Data Programming Guide for Cocoa, Number and Value Programming Topics for Cocoa, and Date and Time Programming Guide for Cocoa.
To gain some insight on the design patterns used in Cocoa, look at Cocoa Design Patterns and Communicating With Objects in Cocoa Fundamentals Guide.
To understand how Cocoa applications for Mac OS X are architected, and how they interact with the operating system, see The Core Application Architecture in Cocoa Fundamentals Guide.
To learn how to draw in a Cocoa application, read Cocoa Drawing Guide.
To learn more about how Cocoa applications handle events, read Cocoa Event-Handling Guide.
If you want to know how to manipulate the views in an application, see View Programming Guide for Cocoa.
To find out how to easily synchronize values between objects in your application, see Cocoa Bindings Programming Topics.
To learn how to automatically manage object graphs and make objects persistent, read Core Data Programming Guide.
If you want to open and save files in your application, read Application File Management.
If your application creates and manages multiple documents, read Document-Based Applications Overview.
If you want to make your application responsive to AppleScript commands, read Cocoa Scripting Guide.
If you have existing code written for Carbon, UNIX, or another platform, you can often integrate much of that code base into a Cocoa application. Read the following information for guidance on porting and integrating your existing code:
If you have Carbon code you want to merge with Cocoa code, read Carbon-Cocoa Integration Guide. You might also want to browse the project examples CarbonInCocoa and CocoaInCarbon.
If you have UNIX code you want to port, read Porting UNIX/Linux Applications to Mac OS X.
If you have any other C code you want to incorporate, look at the ADC topic page for Core Foundation. Core Foundation is a C API that helps you build programmatic bridges between Objective-C and C-based APIs, particularly Carbon.
If you have a 32-bit Cocoa application you want to be 64-bit capable, read 64-Bit Transition Guide for Cocoa.
The Cocoa Reference Library includes the following high-level resource pages, which you can bookmark for easy access:
Conceptual and how-to information for Cocoa.
Focused, detailed descriptions in reference format for Cocoa.
Notes containing the latest news about new or changed features in the Cocoa API.
Sample applications demonstrating a wide variety of Cocoa APIs and techniques. If you have installed the developer package or the Xcode CD, you might also want to look at the example projects in /Developer/Examples/Foundation and /Developer/Examples/AppKit.
Late-breaking documents on issues related to Cocoa.
Programming tips, code snippets, and FAQs by Apple’s support engineers.
Mailing Lists
The Cocoa development mailing list (cocoa-dev) is an excellent place to discuss issues or topics with fellow Cocoa developers.
Last updated: 2008-10-15