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

Commit

Permalink
Merge pull request #37 from omaralbeik/v1.4.1
Browse files Browse the repository at this point in the history
Add test cases for failable initializers, update SPM code
  • Loading branch information
omaralbeik authored Jun 5, 2019
2 parents 9399dcc + 1be5660 commit b743b0d
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 8 deletions.
14 changes: 13 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

// swift-tools-version:5.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(name: "UserDefaultsStore", dependencies: [], exclude: ["Tests"])
let package = Package(
name: "UserDefaultsStore",
products: [
.library(name: "UserDefaultsStore", targets: ["UserDefaultsStore"])
],
dependencies: [],
targets: [
.target(name: "UserDefaultsStore", dependencies: [])
]
)
25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<a href="https://cocoapods.org/pods/UserDefaultsStore"><img src="https://img.shields.io/cocoapods/v/UserDefaultsStore.svg" alt="Cocoapods" /></a>
<a href="https://github.com/Carthage/Carthage"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" alt="Carthage compatible" /></a>
<a href="https://swift.org/package-manager/"><img src="https://img.shields.io/badge/SPM-compatible-4BC51D.svg?style=flat" alt="Swift Package Manager compatible" /></a>
<a href="https://swift.org"><img src="https://img.shields.io/badge/Swift-4.2-orange.svg" alt="Swift" /></a>
<a href="https://swift.org"><img src="https://img.shields.io/badge/Swift-5-orange.svg" alt="Swift" /></a>
<a href="https://developer.apple.com/xcode"><img src="https://img.shields.io/badge/Xcode-10-blue.svg" alt="Xcode"></a>
<a href="https://github.com/omaralbeik/UserDefaultsStore/blob/master/LICENSE"><img src="https://img.shields.io/badge/License-MIT-red.svg" alt="MIT"></a>
</p>
Expand Down Expand Up @@ -42,14 +42,27 @@ You love Swift's `Codable` protocol and use it everywhere, who doesn't! Here is
<details>
<summary>Swift Package Manager</summary>
</br>
<p>The <a href="https://swift.org/package-manager/">Swift Package Manager</a> is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It is in early development, but UserDefaultsStore does support its use on supported platforms.</p>
<p>Once you have your Swift package set up, adding UserDefaultsStore as a dependency is as easy as adding it to the dependencies value of your Package.swift.</p>
<p>You can use <a href="https://swift.org/package-manager">The Swift Package Manager</a> to install <code>UserDefaultsStore</code> by adding the proper description to your <code>Package.swift</code> file:</p>

<pre><code class="swift language-swift">import PackageDescription
dependencies: [
.package(url: "https://github.com/omaralbeik/UserDefaultsStore.git", from: "1.0.2")
]

let package = Package(
name: "YOUR_PROJECT_NAME",
targets: [],
dependencies: [
.package(url: "https://github.com/omaralbeik/UserDefaultsStore.git", from: "1.4.1")
]
)
</code></pre>

<p>Next, add <code>UserDefaultsStore</code> to your targets dependencies like so:</p>
<pre><code class="swift language-swift">.target(
name: "YOUR_TARGET_NAME",
dependencies: [
"UserDefaultsStore",
]
),</code></pre>
<p>Then run <code>swift package update</code>.</p>
</details>

<details>
Expand Down
5 changes: 5 additions & 0 deletions Tests/SingleStoreTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ final class SingleStoreTests: XCTestCase {
XCTAssertNotNil(store)
}

func testCreateInvalidStore() {
let invalidStore = SingleUserDefaultsStore<Bool>(uniqueIdentifier: UserDefaults.globalDomain)
XCTAssertNil(invalidStore)
}

func testSaveObject() {
let store = createFreshUsersStore()!

Expand Down
5 changes: 5 additions & 0 deletions Tests/StoreTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ final class StoreTests: XCTestCase {
XCTAssertNotNil(store)
}

func testCreateInvalidStore() {
let invalidStore = UserDefaultsStore<TestUser>(uniqueIdentifier: UserDefaults.globalDomain)
XCTAssertNil(invalidStore)
}

func testSaveObject() {
let store = createFreshUsersStore()!

Expand Down
2 changes: 1 addition & 1 deletion UserDefaultsStore.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "UserDefaultsStore"
s.version = "1.4"
s.version = "1.4.1"
s.summary = "Why not use UserDefaults to store Codable objects 😉"
s.description = <<-DESC
You love Swift"s Codable protocol and use it everywhere, here is an easy and very light way to store - reasonable amount 😅 - of Codable objects, in a couple lines of code.
Expand Down

0 comments on commit b743b0d

Please sign in to comment.