Writing Blocks

Writing really has two parts: the return type and argument definitions, and the code for implementing its behavior. This is the definition format:

^(<ReturnType>)(<Arguments>){<Statements>};

Image ReturnType is the variable type returned by a block, if any.

Image Arguments is an optional list of arguments.

Image Statements is the code implementing the behavior and can be anything you would normally write in Objective-C. ...

Get Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming now with O’Reilly online learning.

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