Blocks
Block literal
^{
NSLog(@"This is a block");
}As a local variable
returnType (^blockName)(parameterTypes) = ^returnType(parameters) {...};
// Declare
void (^simpleBlock)(void);
// Assign
simpleBlock = ^{
...
};
// Invoke
simpleBlock();As a property
As a method parameter and argument
As a typedef
__block
Avoid Strong Reference Cycles when Capturing self
Last updated