Chapter 19: Building a (Core) Foundation

As an iOS developer, you will spend most of your time using the UIKit and Foundation frameworks. UIKit provides user interface elements like UIView and UIButton. Foundation provides basic data structures like NSArray and NSDictionary. These can handle the vast majority of problems the average iOS application will encounter. But there are some things that require lower-level frameworks. The names of these lower-level frameworks often start with the word “Core”: Core Text, Core Graphics, and Core Video, for example. What they all have in common are C-based APIs based on Core Foundation.

Core Foundation provides a C API that is similar to the Objective-C Foundation framework. It provides a consistent object model with reference counting and containers, just like Foundation, and simplifies passing common data types to low-level frameworks. As you see later in this chapter, Core Foundation is tightly coupled with Foundation, making it easy to pass data between C and Objective-C.

In this chapter, you learn the Core Foundation data types and naming conventions. You learn about Core Foundation allocators and how they provide greater flexibility than +alloc provides in Objective-C. This chapter extensively covers Core Foundation string and binary data types. You discover Core Foundation collection types, which are more flexible than their Foundation counterparts and include some not found Objective-C like tree structures. Finally, you learn how ...

Get iOS 5 Programming Pushing the Limits: Developing Extraordinary Mobile Apps for Apple iPhone, iPad, and iPod Touch 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.