@property (nonatomic,copy) void(^completion)(MyObject * obj);
什么是正确的方式这样做迅速?
class MyClass { var completion : ((MyObject) -> Void)? // or ...! for an implicitly unwrapped optional }
您可以设置属性
completion = { (obj : MyObject) -> Void in // do something with obj ... }
可以缩短(由于自动类型推断)
completion = { obj in // do something with obj ... }