4. Common Objective-C Patterns

Every programming language encourages a different set of design patterns. Understanding the common ones used throughout the Foundation framework makes understanding the framework as a whole, and writing Objective-C code, a lot easier.

This chapter provide an overview of some of the most common patterns in Objective-C. If you want to read more, you can find a much more detailed overview in Cocoa Design Patterns, by Erik M. Buck and Donald A. Yacktman (Addison-Wesley, 2009).

Supporting Two-Stage Creation

Image

From: allocInit.m

One of the patterns you’ve probably already seen is the two-stage creation pattern. In traditional, ...

Get Objective-C Phrase Book, Second Edition 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.