Skip to content

The easiest way to keep track of the current iCloud user

License

Notifications You must be signed in to change notification settings

JagCesar/CloudKitCurrentUser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CloudKitCurrentUser

Build Status Carthage compatible CloudKitCurrentUser License Language Twitter

Purpose

CloudKitCurrentUser is a wrapper around CloudKit that helps out to keep track of the current user signed in state.

Features

  • 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

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 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.