Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #23 from ArtSabintsev/improvement/SupportingDocs
Browse files Browse the repository at this point in the history
Supporting Docs
  • Loading branch information
ArtSabintsev authored Mar 4, 2017
2 parents 72179fc + 0ea2269 commit 5375fc8
Show file tree
Hide file tree
Showing 39 changed files with 2,461 additions and 64 deletions.
7 changes: 7 additions & 0 deletions .jazzy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module: Zephyr
author: Arthur Ariel Sabintsev
author_url: http://www.sabintsev.com
github_url: https://github.com/artsabintsev/zephyr
copyright: "© 2015-2017 [Arthur Ariel Sabintsev](http://www.sabintsev.com)"
clean: true
podspec: ../Zephyr.podspec
10 changes: 10 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
included:
- ../Sources/

disabled_rules:
- cyclomatic_complexity
- file_length
- line_length
- variable_name

reporter: "xcode"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Zephyr

### Effortlessly sync NSUserDefaults over iCloud
[![Platform](https://img.shields.io/cocoapods/p/Zephyr.svg?style=flat)](http://cocoadocs.org/docsets/Zephyr)
### Effortlessly sync UserDefaults over iCloud
[![Platform](https://img.shields.io/cocoapods/p/Zephyr.svg?style=flat)](http://cocoadocs.org/docsets/Zephyr)

[![CocoaPods](https://img.shields.io/cocoapods/v/Zephyr.svg)]() [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)]() [![SwiftPM Compatible](https://img.shields.io/badge/SwiftPM-Compatible-brightgreen.svg)]() [![CocoaPods](https://img.shields.io/cocoapods/dt/Zephyr.svg)]() [![CocoaPods](https://img.shields.io/cocoapods/dm/Zephyr.svg)]()
---
Expand Down
20 changes: 8 additions & 12 deletions Zephyr/Zephyr.swift → Sources/Zephyr.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,16 @@ public class Zephyr: NSObject {
fileprivate var registeredObservationKeys = [String]()

/// A queue used to serialize synchronization on monitored keys.
fileprivate let zephyrQueue = DispatchQueue(label: "com.zephyr.queue");
fileprivate let zephyrQueue = DispatchQueue(label: "com.zephyr.queue")

/// A session-persisted variable to directly access all of the NSUserDefaults elements.
fileprivate var zephyrLocalStoreDictionary: [String: Any] {
get {
return UserDefaults.standard.dictionaryRepresentation()
}
}

/// A session-persisted variable to directly access all of the NSUbiquitousKeyValueStore elements.
fileprivate var zephyrRemoteStoreDictionary: [String: Any] {
get {
fileprivate var zephyrRemoteStoreDictionary: [String: Any] {
return NSUbiquitousKeyValueStore.default().dictionaryRepresentation
}
}

/// Zephyr's initialization method.
Expand All @@ -71,7 +67,6 @@ public class Zephyr: NSObject {
NSUbiquitousKeyValueStore.default().synchronize()
}


/// Zephyr's de-initialization method.
deinit {
zephyrQueue.sync {
Expand Down Expand Up @@ -382,7 +377,8 @@ extension Zephyr {
guard let userInfo = (notification as NSNotification).userInfo,
let cloudKeys = userInfo[NSUbiquitousKeyValueStoreChangedKeysKey] as? [String],
let localStoredDate = zephyrLocalStoreDictionary[ZephyrSyncKey] as? Date,
let remoteStoredDate = zephyrRemoteStoreDictionary[ZephyrSyncKey] as? Date , remoteStoredDate.timeIntervalSince1970 > localStoredDate.timeIntervalSince1970 else {
let remoteStoredDate = zephyrRemoteStoreDictionary[ZephyrSyncKey] as? Date,
remoteStoredDate.timeIntervalSince1970 > localStoredDate.timeIntervalSince1970 else {
return
}

Expand Down Expand Up @@ -449,12 +445,12 @@ fileprivate extension Zephyr {
printStatus(status: message)
return
}

let message = "Synchronized key '\(key)' with value '\(value)' \(destination)"
printStatus(status: message)
}
}

/// Prints the subscription state for a specific key if debugEnabled == true
///
/// - Parameters:
Expand All @@ -464,12 +460,12 @@ fileprivate extension Zephyr {
if debugEnabled {
let subscriptionState = subscribed == true ? "Subscribed" : "Unsubscribed"
let preposition = subscribed == true ? "for" : "from"

let message = "\(subscriptionState) '\(key)' \(preposition) observation."
printStatus(status: message)
}
}

/// Prints a status to the console if
///
/// - Parameters:
Expand Down
6 changes: 3 additions & 3 deletions Zephyr.podspec
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Pod::Spec.new do |s|
s.name = "Zephyr"
s.version = "2.2.1"
s.version = "2.2.2"
s.summary = "Effortlessly synchronize UserDefaults over iCloud"

s.description = <<-DESC
Effortlessly synchronize NSUserDefaults over iCloud.
Effortlessly synchronize UserDefaults over iCloud.
DESC

s.ios.deployment_target = '9.0'
Expand All @@ -16,6 +16,6 @@ Pod::Spec.new do |s|
s.authors = { "Arthur Ariel Sabintsev" => "arthur@sabintsev.com"}
s.platform = :ios, "8.0"
s.source = { :git => "https://github.com/ArtSabintsev/Zephyr.git", :tag => s.version.to_s }
s.source_files = 'Zephyr/*.swift'
s.source_files = 'Sources/*.swift'
s.requires_arc = true
end
4 changes: 2 additions & 2 deletions ZephyrExample/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- Zephyr (2.1.0)
- Zephyr (2.2.2)

DEPENDENCIES:
- Zephyr (from `../`)
Expand All @@ -9,7 +9,7 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
Zephyr: d568e6d468ecf6f145aa167075e8c9f6275bc26e
Zephyr: 542de42ddc36b4b66c346734296f53a86b6df2d2

PODFILE CHECKSUM: 685dec8aa95ee80fb21e94678cd2cebefcbca2dc

Expand Down
16 changes: 8 additions & 8 deletions ZephyrExample/Pods/Local Podspecs/Zephyr.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ZephyrExample/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 34 additions & 34 deletions ZephyrExample/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ZephyrExample/Pods/Target Support Files/Zephyr/Info.plist

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions ZephyrExample/ZephyrExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
8E5ACC931E21882600FF1FA3 /* Embed Frameworks */,
6564D4E520F1F553B01BF248 /* [CP] Embed Pods Frameworks */,
A4A2D785EF449CC7D4507231 /* [CP] Copy Pods Resources */,
55E37D1C1E6AA2C300B4F092 /* SwiftLint */,
);
buildRules = (
);
Expand Down Expand Up @@ -174,6 +175,20 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
55E37D1C1E6AA2C300B4F092 /* SwiftLint */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = SwiftLint;
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which swiftlint >/dev/null; then\nswiftlint lint --config ../.swiftlint.yml\nelse\necho \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi";
};
5AC64B40A946063407FF6C6D /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down
Loading

0 comments on commit 5375fc8

Please sign in to comment.