GitPedia

Zephyr

Effortlessly synchronize UserDefaults over iCloud.

From ArtSabintsev·Updated June 19, 2026·View on GitHub·
·Archived

Zephyr synchronizes specific keys and/or all of your [UserDefaults](https://developer.apple.com/documentation/foundation/userdefaults) over iCloud using [NSUbiquitousKeyValueStore](https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUbiquitousKeyValueStore_class/). The project is written primarily in Swift, distributed under the MIT License license, first published in 2015. Key topics include: background-monitoring, carthage, cocoapods, icloud, icloud-key.

Latest release: 3.8.0Set Custom UserDefaults Suite
March 21, 2024View Changelog →

Zephyr 🌬️

Effortlessly sync UserDefaults over iCloud

Swift Support Platform CocoaPods SwiftPM Compatible


About

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.

Features

  • CocoaPods and SwiftPM Support
  • Syncs specific UserDefaults keys or all of your UserDefaults.
  • Background monitoring and synchronization between UserDefaults and NSUbiquitousKeyValueStore
  • Detailed Logging

Installation Instructions

Swift VersionBranch NameWill Continue to Receive Updates?
5.1+masterYes
5.0swift5.0No
4.2swift4.2No
4.1swift4.1No
3.2swift3.2No
3.1swift3.1No

CocoaPods

ruby
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

Swift Package Manager

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

Manual

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

Swift
Zephyr.sync()

Sync a specific key or keys (Variadic Option)

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

Sync a specific key or keys (Array Option)

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

Add/Remove Keys for Background Monitoring (Variadic Option)

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

Add/Remove Keys for Background Monitoring (Array Option)

Swift
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

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

Use a specific UserDefaults suite

swift
if let suite = UserDefaults(suiteName: "group.com.example.app-name") { Zephyr.setUserDefaultsSuite(to: suite) }

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

Contributors

Showing top 12 contributors by commit count.

View all contributors on GitHub →

This article is auto-generated from ArtSabintsev/Zephyr via the GitHub API.Last fetched: 6/29/2026