Chapter 14

Blocks and Concurrency

In this chapter, we’ll discuss blocks, an Objective-C feature that enhances what you can do with functions. You can use blocks in applications that run on iOS (version 4.0 and later) and OS X (10.6 and later). We’ll also talk about concurrency, or how to take advantage of modern devices that can do more than one thing at a time.

You’re Never Too Old to Play with Blocks

Block objects (usually called simply “blocks”) are extensions to C functions. In addition to the code that’s normally part of a function, blocks include variable bindings as well. Blocks are also known as closures.

Blocks have two types of bindings: automatic and managed. Automatic bindings use memory on the stack, and managed bindings are created ...

Get Learn Objective-C on the Mac: For OS X and iOS, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.