O'Reilly logo

Swift Translation Guide for Objective-C Users: Develop and Design by Maurice Kelly

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 7. Blocks and Closures

Blocks are a relatively new addition to iOS and OS X development, and although Apple delivered them as part of Objective-C, they are actually an enhancement to the C language itself. This comes through in their syntax: It is confusing, hard to remember, and unintuitive. Any syntax that inspires developers to create websites like Gosh Darn Block Syntax (http://goshdarnblocksyntax.com) as a blocks cheat sheet cannot be considered to be particularly user friendly.

Despite this, blocks are here to stay, and they’re taking over our APIs. Apple took the time to improve the syntax of blocks, and to provide numerous syntactical optimizations that simplify their usage in many common patterns. They also decided to rename ...

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