Blocks Defined

Blocks are a way to define a block of code that you will use at a later time. Blocks are a lot like methods or functions in that they can take parameters and return a value. Sometimes people refer to blocks as anonymous functions because they are functions that aren’t attached to an entity.

One thing that sets blocks apart is that they are coded in the same scope as the rest of your program so you can add a block without a class definition. Blocks have some other properties that make them very useful. While blocks don’t need to be attached to objects, blocks can be treated as objects. This means that you can code ...

Get Objective-C Quick Syntax Reference now with O’Reilly online learning.

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