Skip to content

Instantly share code, notes, and snippets.

@ezefranca
Forked from paulrehkugler/RecursiveBlock.m
Created December 1, 2015 17:25
Show Gist options
  • Save ezefranca/03603d6cc97ebe5d72de to your computer and use it in GitHub Desktop.
Save ezefranca/03603d6cc97ebe5d72de to your computer and use it in GitHub Desktop.
Recursive Block
// Follow up to - https://gist.github.com/paulrehkugler/11063725
BOOL baseCaseCondition = NO; // obviously this should be data driven, not hardcoded
typedef void (^RecursiveBlock)(void (^)());
RecursiveBlock aRecursiveBlock;
aRecursiveBlock = ^(RecursiveBlock block){
if ((baseCaseCondition) && block)
{
block(block);
}
};
aRecursiveBlock(aRecursiveBlock);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment