User Tools

Site Tools


ios-labs-s14:advanced-blocks

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
ios-labs-s14:advanced-blocks [2014/03/01 11:51]
mbarboi
ios-labs-s14:advanced-blocks [2015/10/30 11:54] (current)
mbarboi
Line 1: Line 1:
 =====Blocks===== =====Blocks=====
-A block is a chunk of code encapsulated within a variable. It can be passed along as a method parameter or assigned as a class property. It can be executed at any point. Blocks can be passed arguments. ​+A block (or closure) ​is a chunk of code encapsulated within a variable. It can be passed along as a method parameter or assigned as a class property. It can be executed at any point. Blocks can be passed arguments. ​
  
 The main usefulness of blocks is the ability to provide reactive implementations to events that may occur asynchronously or in remote objects. Examples: handling asynchronous HTTP replies, reacting to the end of an animation, etc. The main usefulness of blocks is the ability to provide reactive implementations to events that may occur asynchronously or in remote objects. Examples: handling asynchronous HTTP replies, reacting to the end of an animation, etc.
  
-In other languages ​blocks ​are also known as closures. ​+With Swift, the name of blocks ​changed to "closures."
  
 +See [[http://​fuckingswiftblocksyntax.com/​|freakingswiftblocksyntax.com]] for swift closure syntax. Ignore the section below. ​
  
-===Using Blocks===+===Using Blocks ​(Deprecated:​ Objective-C)===
 Blocks are always denoted by a caret (^). This section will only cover the use of blocks provided by other classes, not the creation of your own blocks. Blocks are always denoted by a caret (^). This section will only cover the use of blocks provided by other classes, not the creation of your own blocks.
  
ios-labs-s14/advanced-blocks.txt ยท Last modified: 2015/10/30 11:54 by mbarboi