• Stars
    star
    899
  • Rank 48,766 (Top 1.0 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 8 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Effortlessly synchronize UserDefaults over iCloud.

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

CocoaPods

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

.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

Zephyr.sync()

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(_:)
Zephyr.sync()

Use a specific UserDefaults suite

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

More Repositories

1

Siren

Notify users when a new version of your app is available and prompt them to upgrade.
Swift
4,140
star
2

Harpy

Notify users when a new version of your app is available and prompt them to upgrade.
Objective-C
2,600
star
3

FontBlaster

Programmatically load custom fonts into your iOS, macOS and tvOS app.
Swift
1,135
star
4

Guitar

A Cross-Platform String and Regular Expression Library written in Swift.
Swift
660
star
5

Solarized-Dark-for-Xcode

Solarized Dark Theme for Xcode. Compatible with all modern versions of Xcode since 2013!
Shell
366
star
6

UIFloatLabelTextField

A subclassed UITextField that follows the Float Label UI design pattern.
Objective-C
323
star
7

Magic

A Swift alternative for Objective-C's DLog macro.
Ruby
283
star
8

UIFloatLabelTextView

A subclassed UITextView that follows the Float Label UI design pattern.
Objective-C
174
star
9

Freedom

The Freedom to Open URLs in Third-Party Browsers on iOS with Custom UIActivity Subclasses.
Swift
86
star
10

Asynchronous-Freeloader

Multithreaded Asynchronous Image Downloader
Objective-C
22
star
11

Cognac

An Alluring, Dark, and Muted Theme For Your Favorite Text Editor.
16
star
12

Cognac-Xcode

An Alluring, Dark, and Muted Theme For Xcode.
Shell
14
star
13

GitFame

A Swift CLI script that logs your GitHub Stars and Forks.
Makefile
13
star
14

MaterialSwitch

A Material Design inspired switch for iOS
Swift
12
star
15

UIDevice-SupportedDevices

An Objective-C category on UIDevice that returns devices based on the supportedDevices key in the JSON results returned in an iTunes Lookup API call.
Objective-C
12
star
16

UIView-AutoLayoutView

A small Objective-C category on UIView that creates a UIView object that is ready to be used in programmatic AutoLayout.
Objective-C
9
star
17

UIColor-ColorWithHexAndAlpha

A category on UIColor that enables you to use hex values to create UIColor objects.
Objective-C
8
star
18

iOSDevCampDC-2018

My talk on Scaling iOS Architecture for iOSDevCampDC 2018.
5
star
19

Panhandler

Remind your active users to rate and review your iOS app
Objective-C
5
star
20

Cognac-iTerm

An Alluring, Dark, and Muted Syntax Theme For iTerm2.
3
star
21

Cognac-VSCode

An Alluring, Dark, and Muted Syntax Theme For Visual Studio Code.
3
star
22

artsabintsev.github.io

My Homepage.
CSS
2
star
23

NSDate-DateFromBSONObjectID

Convert MongoDB's BSON ObjectID to NSDate
Objective-C
2
star
24

Swift-3-CocoaHeads-DC-Talk

My talk on Swift 3 at CocoaHeads DC on July 7, 2016.
Swift
2
star
25

iOSDevCampDC-2017

My Talk on Open Source Software Development for iOSDevCampDC 2017.
2
star
26

cocoaheads-ukraine-2017

My Talk on Open Source Software Development for CocoaHeads Ukraine #13 in 2017
1
star
27

Apple-Watch-WatchKit-CocoaHeads-DC-Talk-

Keynote, PDF, and Sample Project for my WatchKit Talk.
Swift
1
star
28

Cognac-Terminal

An Alluring, Dark, and Muted Theme For The macOS Terminal.
1
star
29

Simple-Class-Portraits

A simple addon for World of Warcraft.
Lua
1
star