Skip to content

Instantly share code, notes, and snippets.

@steipete
Created October 24, 2010 15:20
Show Gist options
  • Save steipete/643594 to your computer and use it in GitHub Desktop.
Save steipete/643594 to your computer and use it in GitHub Desktop.
// some credits go to http://www.mikeash.com/pyblog/friday-qa-2009-08-14-practical-blocks.html
typedef void (^BasicBlock)(void);
void RunAfterDelay(NSTimeInterval delay, BasicBlock block) {
[[[block copy] autorelease] performSelector:@selector(ps_callBlock) withObject:nil afterDelay:delay];
}
@implementation NSObject (BlocksAdditions)
- (void)ps_callBlock {
void (^block)(void) = (id)self;
block();
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment