Swiftpack.co - Package - ArtSabintsev/Zephyr

Zephyr 🌬️

Effortlessly sync UserDefaults over iCloud

Swift Support Platform Documentation

CocoaPods Carthage Compatible SwiftPM Compatible


Zephyr synchronizes specific keys and/or all of your UserDefaults 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.


  • [x] CocoaPods, Carthage, and SwiftPM Support
  • [x] Syncs specific UserDefaults keys or all of your UserDefaults.
  • [x] Background monitoring and synchronization between UserDefaults and NSUbiquitousKeyValueStore
  • [x] Detailed Logging
  • [x] Documentation at http://sabintsev.com/Zephyr/

Installation Instructions

| Swift Version | Branch Name | Will Continue to Receive Updates? | ------------- | ------------- | ------------- | 5.1 | master | Yes | 5.0 | swift5.0 | No | 4.2 | swift4.2 | No | 4.1 | swift4.1 | No | 3.2 | swift3.2 | No | 3.1 | swift3.1 | No


pod 'Zephyr' # Swift 5.1
pod 'Zephyr', :git => 'https://github.com/ArtSabintsev/Zephyr.git', :branch => 'swift5.0' # Swift 5.0
pod 'Zephyr', :git => 'https://github.com/ArtSabintsev/Zephyr.git', :branch => 'swift4.2' # Swift 4.2
pod 'Zephyr', :git => 'https://github.com/ArtSabintsev/Zephyr.git', :branch => 'swift4.1' # Swift 4.1
pod 'Zephyr', :git => 'https://github.com/ArtSabintsev/Zephyr.git', :branch => 'swift3.2' # Swift 3.2
pod 'Zephyr', :git => 'https://github.com/ArtSabintsev/Zephyr.git', :branch => 'swift3.1' # Swift 3.1


github "ArtSabintsev/Zephyr" // Swift 5.1
github "ArtSabintsev/Zephyr" "swift5.0" // Swift 5.0
github "ArtSabintsev/Zephyr" "swift4.2" // Swift 4.2
github "ArtSabintsev/Zephyr" "swift4.1" // Swift 4.1
github "ArtSabintsev/Zephyr" "swift3.2" // Swift 3.2
github "ArtSabintsev/Zephyr" "swift3.1" // Swift 3.1

Swift Package Manager

.Package(url: "https://github.com/ArtSabintsev/Zephyr.git", majorVersion: 3)


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


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 UserDefaults or NSUbiquitousKeyValueStore is newer. To make sure there's no overwriting going on in a fresh installation of your app on a new device that's connected to the same iCloud account, make sure that your UserDefaults are registered BEFORE calling any of the Zephyr methods. One way to easily achieve this is by using the UserDefaults Register API.

Sync all UserDefaults


Sync a specific key or keys (Variadic Option)

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

Sync a specific key or keys (Array Option)

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

Add/Remove Keys for Background Monitoring (Variadic Option)

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

Add/Remove Keys for Background Monitoring (Array Option)

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

Toggle Automatic Calling of NSUbiquitousKeyValueStore's Synchronization method

Zephyr.syncUbiquitousKeyValueStoreOnChange = true // Default
Zephyr.syncUbiquitousKeyValueStoreOnChange = false // Turns off instantaneous synchronization

Debug Logging

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

Sample App

Please ignore the Sample App as I did not add any demo code in the Sample App. It's only in this repo to add support for Carthage.

Created and maintained by

Arthur Ariel Sabintsev


Stars: 630
Help us keep the lights on


Used By

Total: 1


3.5.0 - Sep 15, 2019

This release adds support for Swift 5.1, iOS 13, and Xcode 11. Full updates here: #44

3.4.2 - Aug 30, 2019

On working on a personal application of mine, I noticed that synchronization on a second/subsequent device did not work on that device's first launch of an application. After further investigation, I noticed that the syncFromCloud method did not actually post a notification on completion. This has now been fixed.

3.4.1 - Aug 8, 2019

I fixed the Package.swift so that it is now compatible with Xcode 11 and the latest Swift Package Manifest file (// swift-tools-version:4.0).

3.4.0 - Apr 19, 2019

#36: Notifications will now be posted after an iCloud sync has occurred (thanks to @twostraws)

3.3.0 - Mar 31, 2019

As of Zephyr v3.3.0, all future changes on master will be done in Xcode 10.2 using Swift 5.0.

For those using Swift v4.2, please check out the swift4.2 branch or version 3.2.0 - both point to the same commit hash.