Is it possible that Bridging-header turns (void (^)(NSError *))block (ObjC) into block: () throws -> () (Swift)?
问题 I have OBJC: - (void)doSomething:(void (^)(NSError *))block; SWIFT: let test = Test() test.doSomething(<#T##block: ((Error?) -> Void)!##((Error?) -> Void)!##(Error?) -> Void#>) I would rather try? test.doSomething { } I would like bridging-header to translate the function into func doSomething(block: () throws -> ()) throws { try block() } Is it possible? Thanks to all! 回答1: Your Objective-C method is declaring a parameter which is a block that receives an NSError object. It's basically