記錄一下,如果Objective-C有個方法如下宣告
-(void)POST:(NSString *)userId withCrashTitle:(NSString *)title andContent:(NSString *)content success:(void (^)(BOOL))success failure:(void (^)(NSError *))failure {
}
若改寫為Swift如下
func mailErrorLog(userId:String, withCrashTitle:String, andContent:String, success:(Bool) -> Void, failure:(Error) -> Void) -> Void {
}
參考文章 https://hugolu.gitbooks.io/learn-swift/content/Basic/Closure.html
沒有留言:
張貼留言