Skip to content

davehakim/Zephyr

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zephyr

Effortlessly sync NSUserDefaults over iCloud


About

Zephyr synchronizes specific keys and/or all of your NSUserDefaults over iCloud using NSUbiquitousKeyValueStore.

Zephyr has built in monitoring, allowing it to sync specific keys in the background as they change.

For the latest updates, refer to the Releases tab.

Features

  • CocoaPods Support
  • Syncs all your NSUserDefaults (if you wish)
  • Syncs only specific keys in NSUserDefaults
  • Background monitoring and synchronization between NSUserDefaults and NSUbiquitousKeyValueStore
  • Detailed Logging

Installation Instructions

CocoaPods Installation

pod 'Zephyr'
  • Add import Zephyr to any .Swift file that references Zephyr via a CocoaPods installation.

Manual Installation

  1. Download Zephyr
  2. Copy Zephyr.swift into your project.

Setup

Turn on iCloud Sync in Xcode

In Xcode, open your app's project/workspace file:

  • Click on your Project
  • Click on one of your Targets
  • Click on Capabilities
  • Turn on iCloud syncing
  • Under Services, make sure to check Key-value storage
  • Repeat for all Targets (if necessary)

How to turn on iCloud Key Value Store Syncing

Integrate Zephyr into your App

Before performing each sync, Zephyr automatically checks to see if the data in NSUserDefaults or NSUbiquitousKeyValueStore is newer.

Sync all NSUserDefaults

Zephyr.sync()

Sync a specific key or keys (Variadic Option)

Zephyr.sync("MyFirstKey", "MySecondKey", ...)

Sync a specific key or keys (Array Option)

Zephyr.sync(["MyFirstKey", "MySecondKey"])

Add/Remove Keys for Background Monitoring (Variadic Option)

Zephyr.addKeysToBeMonitored("MyFirstKey", "MySecondKey", ...)
Zephyr.removeKeysFromBeingMonitored("MyFirstKey", "MySecondKey", ...)

Add/Remove Keys for Background Monitoring (Array Option)

Zephyr.addKeysToBeMonitored(["MyFirstKey", "MySecondKey"])
Zephyr.removeKeysFromBeingMonitored(["MyFirstKey", "MySecondKey"])

Debug Logging

Zephyr.debugEnabled = true // Must be called before sync(_:)
Zephyr.sync()

Created and maintained by

Arthur Ariel Sabintsev

About

Effortlessly synchronize NSUserDefaults over iCloud.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 96.6%
  • Ruby 3.4%