Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
dispatch_block_t RecursiveBlock(void (^block)(dispatch_block_t recurse))
{
// assuming ARC, so no explicit copy
return ^{ block(RecursiveBlock(block)); };
}
typedef void (^OneParameterBlock)(id parameter);
OneParameterBlock RecursiveBlock1(void (^block)(OneParameterBlock recurse, id parameter))
{
return ^{ block(RecursiveBlock1(block), parameter) };
}
use:
dispatch_block_t block = RecursiveBlock(^(dispatch_block_t recurse) {
if(!done)
recurse();
else
...
});
block();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.