Objective-C
@interface Hoge
@property (nonatomic, copy) void(^onClick)(NSString *);
@end
Hoge *hoge = [[Hoge alloc] init];
hoge.onClick = ^(NSString *text) {
NSLogt(@"%@", text);
};
Swift
class Hoge {
var onClick: ((String) -> Void)?
}
func f(text: String) {
println(text)
}
var hoge = Hoge()
hoge.onClick = f