Skip to content

Instantly share code, notes, and snippets.

@insidegui
Created March 5, 2017 20:38
Show Gist options
  • Save insidegui/4a282db0d8843b1503087f85fe8c3039 to your computer and use it in GitHub Desktop.
Save insidegui/4a282db0d8843b1503087f85fe8c3039 to your computer and use it in GitHub Desktop.
CKContainer.default().requestApplicationPermission(.userDiscoverability) { status, error in
guard status == .granted, error == nil else {
// error handling voodoo
return
}
CKContainer.default().discoverUserIdentity(withUserRecordID: recordID) { identity, error in
guard let components = identity?.nameComponents, error == nil else {
// more error handling magic
return
}
DispatchQueue.main.async {
let fullName = PersonNameComponentsFormatter().string(from: components)
print("The user's full name is \(fullName)")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment