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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Rights 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
DOI: https://doi.org/10.1007/978-1-4302-4270-3_7
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4302-4269-7
Online ISBN: 978-1-4302-4270-3
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)