O'Reilly logo

Learn Objective-C on the Mac: For OS X and iOS, Second Edition by Scott Knaster, Waqar Malik, Mark Dalrymple

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 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 ...

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