Advertisement

Writing Modern Code with Blocks

  • Jeff Kelley

Abstract

If there#x2019;s a trend to be picking up on with regards to Apple#x2019;s development of the developer tools and languages surrounding Cocoa Touch#x2019;s development, it#x2019;s that Apple is trying to make things as easy as possible for developers to create engaging, easy-to-use apps. It seems that with every new iOS release, there are more ways in which your life gets easier as a Cocoa Touch developer. One such way occurred with iOS 4.0 and Mac OS X Snow Leopard and is actually a new feature added by Apple to the C language: blocks. C language development in general moves at a glacial pace, so any new features are news just by being new features added to C. Blocks are exciting for much more than that; they allow greater freedom, more logical code grouping, and better encapsulation in your code. In this chapter, we#x2019;ll discuss what blocks are, how they work, and why you#x2019;ll want to use them. We#x2019;ll also cover some of Apple#x2019;s new APIs that require you to use blocks, a glimpse of which you#x2019;ve already gotten in the Twitter example from Chapter 6. Finally, we#x2019;ll revisit that example to expand on its features, turning it into a much better app. First, let#x2019;s talk about what blocks even are.

Keywords

Memory Management Return Type Main Thread Head File Twitter Controller 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Copyright information

© Jeff Kelley 2012

Authors and Affiliations

  • Jeff Kelley

There are no affiliations available

Personalised recommendations