https://github.com/jagcesar/cloudkitcurrentuser
The easiest way to keep track of the current iCloud user
https://github.com/jagcesar/cloudkitcurrentuser
Last synced: about 1 year ago
JSON representation
The easiest way to keep track of the current iCloud user
- Host: GitHub
- URL: https://github.com/jagcesar/cloudkitcurrentuser
- Owner: JagCesar
- License: mit
- Created: 2016-12-02T20:53:58.000Z (over 9 years ago)
- Default Branch: develop
- Last Pushed: 2019-06-25T16:35:09.000Z (almost 7 years ago)
- Last Synced: 2025-03-24T05:43:57.715Z (about 1 year ago)
- Language: Swift
- Homepage:
- Size: 35.2 KB
- Stars: 8
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CloudKitCurrentUser
[](https://app.bitrise.io/app/d9b9c1de80d7d8ca)
[](https://github.com/Carthage/Carthage)
[](https://github.com/JagCesar/CloudKitCurrentUser)
[](https://github.com/JagCesar/CloudKitCurrentUser/blob/master/LICENSE)
[](https://swift.org)
[](http://twitter.com/JagCesar)
## Purpose
CloudKitCurrentUser is a wrapper around CloudKit that helps out to keep track of the current user signed in state.
## Features
- [x] Asyncronous loading of signed in state
- [x] Automatic refresh of signed in state
- [x] Caching of signed in state
- [x] Notification when the user signed in status changes
## Requirements
- iOS 9.0+
- Xcode 8.1+
- Swift 3.0+
## Installation
### Carthage
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](https://github.com/Carthage/Carthage#installing-carthage) for more information on how you set up Carthage.
## Usage
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
}
```
## Get in touch
Feel free to get in touch if you have any questions. I'm available on Twitter as [@JagCesar](http://twitter.com/JagCesar).