2

Hey guys so I recently updated my Xcode version to Xcode 8 and I have started getting these errors in the new betas that I haven't gotten before.

        CSSearchableIndex.default().indexSearchableItems([searchableItem]) { // Error.

        (error : NSError?) -> Void in

        if error != nil {

            print(error?.localizedDescription)
        }
    }

Here's the error : enter image description here

Amit Kalra
  • 4,085
  • 6
  • 28
  • 44
  • 1
    FYI, the `Error` type is discussed briefly in the [Xcode 8 Beta Release Notes](https://developer.apple.com/go/?id=xcode-8-beta-rn). – Rob Aug 10 '16 at 00:16

1 Answers1

1

Rather than NSError, use Error. Or, let the compiler infer this for you.

CSSearchableIndex.default().indexSearchableItems([searchableItem]) { error in
    if error != nil {
        print(error!.localizedDescription)
    }
}
Rob
  • 415,655
  • 72
  • 787
  • 1,044