I updated Xcode to 10.2 today and I got the following errors:

Method cannot be marked @objc because the type of the parameter 2 cannot be represented in Objective-C

Function types cannot be represented in Objective-C unless their parameters and returns can be I don't understand why

It was perfectly fine in 10.1. This is an example that I have been using for years without any issues. How can I make this code to compile without errors?

@objc public func myFunction(inputString: String, handler:@escaping ((success: Bool, outPut: NSArray)) -> Void) {
    // do stuff
}
1

There are 1 best solutions below

3
On BEST ANSWER

Delete the phrase outPut:. It was always illegal; Swift 5 just tightens up at last.

So:

@objc public func myFunction(inputString: String, handler:@escaping (NSArray) -> Void) {