BlackHatSamurai BlackHatSamurai - 11 months ago 602
iOS Question

Issue with NSLog with Swift 3

After migrating to Swift 3, I get an error when I try and do:, completionHandler: { (record, error) -> Void in
if let saveError = error {
NSLog("There was an error saving the record: %@", saveError)

Can someone tell me why this is and what I can do produce an output with relative ease?

The error is
NSLog unavailable: variadic function unavailable

Answer Source

The problem, despite the "variadic" red herring, is that we no longer get automatic bridging to an Objective-C type; you have to cross the bridge explicitly, yourself. Write saveError as NSError to get an Objective-C style object.