How to Troubleshoot Apps for the Modern Connected Worker
Blocks Objective C
1. Welcome to Blockoland
Objective C Blocks
also known as closures.
Block Name arguments
void (^helloBlock)(void) = ^ void (void){ NSLog(@"Hello, World!"); };
Return Type Block Logic
Blocks were part of Smalltalk They were not a high priority for Objective-C, initially.
2. Block Declarations with
Typedefs
also known as closures.
Block Name arguments
typedef BOOL (^resultHandler)(id result, NSError *error);
Return Type
BOOL (^resultHandler)(id result, NSError *error);
ResultHandler resultHandler;
ResultHandler resultHandler = ^ BOOL (id result, NSError
*error) {
[result performSomeTask];
return YES;
};
more info