CloudKitCurrentUser is a wrapper around CloudKit that helps out to keep track of the current user signed in state.
- Asyncronous loading of signed in state
- Automatic refresh of signed in state
- Caching of signed in state
- Notification when the user signed in status changes
- iOS 9.0+
- Xcode 8.1+
- Swift 3.0+
The best way to install CloudKitCurrentUser to your project is to use Carthage. To add this dependency to your project you enter the following in your Cartfile:
github "JagCesar/CloudKitCurrentUser"
Take a look at the documentation for more information on how you set up Carthage.
First of all you have to import CloudKitCurrentUser to your current file. To do that you add the following at the top of your swift file:
import CloudKitCurrentUser
To get the status of the current user you just call the currentStatus
function, like this:
CurrentUser.sharedInstance.currentStatus { status, error in
// Act accordingly here
}
And to get the current user identifier, you write the following:
CurrentUser.sharedInstance.userIdentifier { identifier, error in
// Act accordingly
}
Feel free to get in touch if you have any questions. I'm available on Twitter as @JagCesar.