These are chat archives for dictav/dictav.github.com

11th
Mar 2014
Shintaro Abe
@dictav
Mar 11 2014 10:49
@interface NSOperationQueue (Block)
- (void)addOperationWithBlock:(void (^)(void))block;
@end

@implementation NSOperationQueue (Block)
- (void)addOperationWithBlock:(void (^)(void))block
{
        NSInvocationOperation *op;
        op = [[NSInvocationOperation alloc] initWithTarget:self
                                                  selector: @selector(doBlock:)
                                                    object: block];
        [self addOperation:op];
}

- (void)doBlock:(void (^)(void))block
{
        block();
}
@end