I am using CloudKit and have a Model
class with a method which saves user preferences to the cloud database. I have successfully updated my Swift 3 syntax to account for the latest proposals released with Xcode 8 beta 6. However, I have one last error left which I can't seem to resolve. The code for my function is:
func savePreferences(preferences: UserPreferences, completion:
@escaping (CKRecord?, NSError?) -> Void) {
privateDatabase.save(preferences.record) {
record, error in
completion(record, error)
}
}
The signature for the record
property of the UserPreferences
instance used here is:
var record : CKRecord
privateDatabase
is a CKDatabase
.
The error I receive is:
Cannot invoke 'save' with an argument list of type (CKRecord, (CKRecord?, Error?) -> Void)
I have found that removing the call to completion
causes the error to disappear and allows a successful build.
I'm hoping someone can tell me where I am going wrong or if this is a bug with Xcode 8 beta 6.