Skip to content

Instantly share code, notes, and snippets.

@insidegui
Created March 5, 2017 21:38
Show Gist options
  • Save insidegui/8c960b15f65aa123fe9e20fe2ee07226 to your computer and use it in GitHub Desktop.
Save insidegui/8c960b15f65aa123fe9e20fe2ee07226 to your computer and use it in GitHub Desktop.
private func updateUserRecord(_ userRecord: CKRecord, with avatarURL: URL) {
userRecord["avatar"] = CKAsset(fileURL: avatarURL)
CKContainer.default().publicCloudDatabase.save(userRecord) { _, error in
guard error == nil else {
// top-notch error handling
return
}
print("Successfully updated user record with new avatar")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment