O'Reilly logo

Beginning Mac OS® X Programming by Drew McCormack, Michael Trent

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. Using the Cocoa Frameworks

People use the word "Cocoa" in different ways to describe different things. For example, Cocoa can refer to the Objective-C programming language and dynamic runtime. In Chapter 7, you learned how to write simple programs in Objective-C. Some of that material, such as memory management, is specific to Cocoa.

Cocoa also applies to the Objective-C frameworks and libraries commonly used by Cocoa applications. Two principal frameworks among these include AppKit and Foundation. A few other smaller frameworks seem to be a part of the Cocoa family in one way or another, including the PreferencePanes and WebKit frameworks.

The Foundation framework contains Objective-C objects, protocols, and functions that are useful to Mac OS X programs in general, regardless of whether they are meant to be user-friendly applications or low-level system utilities. For example, things like collection classes, file I/O, and memory utilities are defined in Foundation. Also, some functionality commonly thought of as high-level application functionality lives in Foundation because it doesn't involve any user interface. Management of undo and user preferences are all part of Foundation.

The AppKit framework builds upon Foundation to implement classes essential for high-level applications, often limiting itself to graphic elements displayed on the screen. For example, windows, buttons, and menus are all AppKit features. Also, some specialized objects live in AppKit, even ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required