Skip to main content

Writing Modern Code with Blocks

  • Chapter
Learn Cocoa Touch for iOS
  • 954 Accesses

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 34.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 44.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2012 Jeff Kelley

About this chapter

Cite this chapter

Kelley, J. (2012). Writing Modern Code with Blocks. In: Learn Cocoa Touch for iOS. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4302-4270-3_7

Download citation

Publish with us

Policies and ethics