Skip to content

Commit

Permalink
Merge pull request #18 from SentulAsia/master
Browse files Browse the repository at this point in the history
Added docs
  • Loading branch information
SentulAsia authored Jul 2, 2019
2 parents 2a93cee + 07e76bd commit 68996ea
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 24 deletions.
2 changes: 1 addition & 1 deletion DataStoreManager.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
#

s.name = "DataStoreManager"
s.version = "0.4.0"
s.version = "0.5.0"
s.summary = "This library allows you to easily manage persistent data in your iOS app."

# This description is used to generate tags and improve search results.
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ class ViewController: UIViewController, DataStoreManagerDataSource {
}
}

manager.read(forKey: "Key", forType: .keychain) { (object) in
manager.read(forKey: "Key", forType: .keychainServices) { (object) in
if let object = object {
print("successfully read \(object) from SecItem")
print("successfully read \(object) from Keychain Services")
}
}

Expand All @@ -62,7 +62,7 @@ class ViewController: UIViewController, DataStoreManagerDataSource {
}
}

manager.create(value: object, forKey: "Key", forType: .keychain) { (isSuccessful) in
manager.create(value: object, forKey: "Key", forType: .keychainServices) { (isSuccessful) in
if isSuccessful {
print("successfully write to SecItem")
}
Expand All @@ -81,7 +81,7 @@ class ViewController: UIViewController, DataStoreManagerDataSource {
if manager.tag == 3 {
return .userDefaults
} else {
return .keychain
return .keychainServices
}
}
}
Expand Down Expand Up @@ -137,15 +137,15 @@ To install it, simply add the following line to your **Package.swift**:

```swift
dependencies: [
.package(url: "https://github.com/zaidmsaid/DataStoreManager.git", .upToNextMinor(from: "0.4.0"))
.package(url: "https://github.com/zaidmsaid/DataStoreManager.git", .upToNextMinor(from: "0.5.0"))
]
```

or more strict:

```swift
dependencies: [
.package(url: "https://github.com/zaidmsaid/DataStoreManager.git", .exact("0.4.0"))
.package(url: "https://github.com/zaidmsaid/DataStoreManager.git", .exact("0.5.0"))
]
```

Expand Down
41 changes: 24 additions & 17 deletions Sources/DataStoreManager/DataStoreManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,34 +95,41 @@ import Foundation
/// Constants that provide information regarding storage type of data store manager.
@objc public enum StorageType : Int, CaseIterable {

/// The storage type UserDefaults.
/// The storage type [UserDefaults](apple-reference-documentation://hsARFaqWd3).
case userDefaults

/// The storage type FileManager with the search path document directory.
/// The storage type [FileManager](apple-reference-documentation://hsQQiy1kjA)
/// with the search path document directory.
case documentDirectory

/// The storage type FileManager with the search path user home directories (/Users).
/// The storage type [FileManager](apple-reference-documentation://hsQQiy1kjA)
/// with the search path user home directories (`/Users`).
case userDirectory

/// The storage type FileManager with the search path various user-visible documentation, support, and configuration files (/Library).
/// The storage type [FileManager](apple-reference-documentation://hsQQiy1kjA)
/// with the search path various user-visible documentation, support, and
/// configuration files (`/Library`).
case libraryDirectory

/// The storage type FileManager with the search path supported applications (/Applications).
/// The storage type [FileManager](apple-reference-documentation://hsQQiy1kjA)
/// with the search path supported applications (`/Applications`).
case applicationDirectory

/// The storage type FileManager with the search path core services (System/Library/CoreServices).
/// The storage type [FileManager](apple-reference-documentation://hsQQiy1kjA)
/// with the search path core services (`System/Library/CoreServices`).
case coreServiceDirectory

/// The storage type FileManager with the temporary directory for the current user.
/// The storage type [FileManager](apple-reference-documentation://hsQQiy1kjA)
/// with the temporary directory for the current user.
case temporaryDirectory

/// The storage type NSCache.
/// The storage type [NSCache](apple-reference-documentation://hs3dlYnTwl).
case cache

/// The storage type SecItem.
case keychain
/// The storage type [SecItem](https://developer.apple.com/documentation/security/keychain_services).
case keychainServices

/// The storage type NSUbiquitousKeyValueStore.
/// The storage type [NSUbiquitousKeyValueStore](apple-reference-documentation://hskNNwzU6H).
case ubiquitous

/// Converts the storage type value to a native string.
Expand Down Expand Up @@ -154,7 +161,7 @@ import Foundation
case .cache:
return "NSCache"

case .keychain:
case .keychainServices:
return "SecItem"

case .ubiquitous:
Expand Down Expand Up @@ -237,7 +244,7 @@ import Foundation
case .cache:
cacheWorker.create(value: value, forKey: key, completionHandler: completionHandler)

case .keychain:
case .keychainServices:
securityItemWorker.create(value: value, forKey: key, completionHandler: completionHandler)

case .ubiquitous:
Expand Down Expand Up @@ -294,7 +301,7 @@ import Foundation
case .cache:
cacheWorker.read(forKey: key, completionHandler: completionHandler)

case .keychain:
case .keychainServices:
securityItemWorker.read(forKey: key, completionHandler: completionHandler)

case .ubiquitous:
Expand Down Expand Up @@ -353,7 +360,7 @@ import Foundation
case .cache:
cacheWorker.update(value: value, forKey: key, completionHandler: completionHandler)

case .keychain:
case .keychainServices:
securityItemWorker.update(value: value, forKey: key, completionHandler: completionHandler)

case .ubiquitous:
Expand Down Expand Up @@ -410,7 +417,7 @@ import Foundation
case .cache:
cacheWorker.delete(forKey: key, completionHandler: completionHandler)

case .keychain:
case .keychainServices:
securityItemWorker.delete(forKey: key, completionHandler: completionHandler)

case .ubiquitous:
Expand Down Expand Up @@ -465,7 +472,7 @@ import Foundation
case .cache:
cacheWorker.deleteAll(completionHandler: completionHandler)

case .keychain:
case .keychainServices:
securityItemWorker.deleteAll(completionHandler: completionHandler)

case .ubiquitous:
Expand Down

0 comments on commit 68996ea

Please sign in to comment.