我有一个包含这在目的限定的块的方法 - C:如何Objective-C的块转换为夫特闭合
+(void)getNewList:(NewListRequestModel *)model returnInfo:(void(^)(NewListResponseModel* resModel))retModel;
和我调用它喜欢:
[API getNewList:model returnInfo:^(NewListResponseModel *resModel) {
//code
}];
在目的- C 。
现在我想调用它的雨燕3.2:
API.getNewList(model, returnInfo: {(resModel: NewListResponseModel) ->() in
//my code
})
但我总是得到一个错误:
Cannot convert value of type '(NewListResponseModel) -> Void' to expected argument type '((NewListResponseModel?) -> Void)!'
能有人帮我调用它的正确方法?谢谢。
你的意思是它改写成快捷功能?但如果我不想重写它,只需调用objective-c方法即可。你能说出正确的方法吗? – Neko
在桥接头文件中导入目标-c类并调用该函数。 – Pushpendra
它的工作原理,谢谢! – Neko