Created
March 5, 2017 20:38
-
-
Save insidegui/4a282db0d8843b1503087f85fe8c3039 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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