Skip to content

Instantly share code, notes, and snippets.

@yamaneko1212
Created February 8, 2012 01:47
Show Gist options
  • Save yamaneko1212/1764217 to your computer and use it in GitHub Desktop.
Save yamaneko1212/1764217 to your computer and use it in GitHub Desktop.
Blocksのラッパークラス ref: http://qiita.com/items/2082
#import <Foundation/Foundation.h>
typedef void (^CallableBlock)();
@interface BlocksWrapper : NSObject
@property (strong, nonatomic) CallableBlock blocks;
- (BlocksWrapper *)initWithBlocks:(CallableBlock)blocks;
- (void)invoke;
@end
#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