Skip to content

Instantly share code, notes, and snippets.

@lilyball
Created March 24, 2010 23:22
Show Gist options
  • Save lilyball/342946 to your computer and use it in GitHub Desktop.
Save lilyball/342946 to your computer and use it in GitHub Desktop.
#import <Foundation/Foundation.h>
@interface NSRunLoop (NSRunLoop_S9Blocks)
- (void)runBlock:(void (^)(void))block;
@end
#import "NSRunLoop+blocks.h"
@interface NSRunLoop (NSRunLoop_S9Blocks_Internal)
- (void)executeBlock:(void (^)(void))block;
@end
@implementation NSRunLoop (NSRunLoop_S9Blocks)
- (void)runBlock:(void (^)(void))block {
[self performSelector:@selector(executeBlock:) target:self argument:[[block copy] autorelease]
order:0 modes:[NSArray arrayWithObject:NSRunLoopCommonModes]];
}
- (void)executeBlock:(void (^)(void))block {
block();
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment