Chapter 7. Foundation Value Classes

Objective-C makes it easy to use standard C types like int, float, and char, but that doesn’t mean they’re always your best options. Cocoa provides actual classes for storing common types of data like numbers and strings. These are informally called value classes, or Foundation value classes.

This is a good time for me to explain that “Cocoa” can actually mean two separate things. Most people use it very broadly to describe an overall ecosystem to write apps for Mac, iPhone, iPod touch, and iPad. Some veteran Mac programmers think of Cocoa specifically as an umbrella framework, which is a framework that contains other frameworks. Whichever definition you prefer, you should understand what each refers to. The Cocoa framework itself encapsulates three separate frameworks: Foundation, AppKit, and Core Data:


Provides all of the basic building block classes, such as strings, numbers, arrays, file access, and so on. This framework is used on Mac and iPhone OS (which is used by iPhone, iPod touch, and iPad).


Provides everything specifically dealing with user interface elements, such as windows, controls, and fonts. AppKit is the Mac counterpart of UIKit on iPhone OS, and both are built around the same core concepts.

Core Data

Provides data storage, data modeling, and automatic change tracking (also known as automatic Undo and Redo). You can store data using SQLite, XML, binary storage, or even create your own store type. Core Data is available ...

Get Cocoa and Objective-C: Up and Running now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.