Created
March 24, 2010 23:22
-
-
Save lilyball/342946 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface NSRunLoop (NSRunLoop_S9Blocks) | |
- (void)runBlock:(void (^)(void))block; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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