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