Skip to content

Instantly share code, notes, and snippets.

@paulrehkugler
Last active November 7, 2024 18:16
Show Gist options
  • Save paulrehkugler/11143969 to your computer and use it in GitHub Desktop.
Save paulrehkugler/11143969 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