Advertisement

Blocks Implementation

  • Kazuki Sakamoto
  • Tomohiko Furumoto

Abstract

In the previous chapters, we learned that a Block is an anonymous function together with automatic variables. In this chapter, we look at the details of a Block with its implementation to see what happens under the hood of Blocks. We start with the basic idea of the Block’s implementation and then we show various situations to see how the Blocks work, such as how automatic variables are captured, how Blocks and __block variables are stored in memory, and how objects are captured by Blocks. Also, we show some pitfalls of Blocks related to circular reference and copy/release methods. All the example source code assumes ARC is enabled except where specified.

Keywords

Source Code Strong Qualifier Block Specifier Block Variable Instance Method 
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

© Kazuki Sakamoto 2012

Authors and Affiliations

  • Kazuki Sakamoto
  • Tomohiko Furumoto

There are no affiliations available

Personalised recommendations