我在目标C中使用块
typedef void (^RequestSuccessCallback)(WebRequestManager *request);
@property (nonatomic,copy) RequestSuccessCallback RequestSuccessBlock;
但是如何在swift中使用Block?
答案 0 :(得分:2)
尝试这样的事情:
typealias RequestSuccessCallback = (WebRequestManager) -> Void
var requestSuccessBlock: RequestSuccessCallback
如果您更喜欢命名回调,则可能是这样的:
typealias RequestSuccessCallback = (manager: WebRequestManager) -> Void
var requestSuccessBlock: RequestSuccessCallback