Created
February 8, 2012 01:47
-
-
Save yamaneko1212/1764217 to your computer and use it in GitHub Desktop.
Blocksのラッパークラス ref: http://qiita.com/items/2082
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> | |
typedef void (^CallableBlock)(); | |
@interface BlocksWrapper : NSObject | |
@property (strong, nonatomic) CallableBlock blocks; | |
- (BlocksWrapper *)initWithBlocks:(CallableBlock)blocks; | |
- (void)invoke; | |
@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 "BlocksWrapper.h" | |
@implementation BlocksWrapper | |
@synthesize blocks = _blocks; | |
- (BlocksWrapper *)initWithBlocks:(CallableBlock)blocks | |
{ | |
self = [super init]; | |
self.blocks = blocks; | |
return self; | |
} | |
- (void)invoke | |
{ | |
self.blocks(); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment