Hour 20. Working with Blocks

What You’ll Learn in This Hour

Comparing blocks to callbacks

Using typedef and function pointers

Declaring blocks

Using blocks

Revisiting Blocks

Blocks are not new; they were a part of Smalltalk and other languages thirty or more years ago (in some cases they were referred to as closures for reasons that you see in this section). They show up in Ruby, Python, and Lisp as well. For a variety of reasons, they were not implemented on Mac OS X until Snow Leopard (10.6); they have been in iOS since version 4. Because of their long history, for many people using blocks on Mac OS X or iOS is a matter of revisiting concepts they might know from other languages or even from long-ago basic programming courses.

Blocks ...

Get Sams Teach Yourself Objective-C in 24 Hours 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.