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

Commit b743b0d

Browse files
authored
Merge pull request #37 from omaralbeik/v1.4.1
Add test cases for failable initializers, update SPM code
2 parents 9399dcc + 1be5660 commit b743b0d

File tree

5 files changed

+43
-8
lines changed

5 files changed

+43
-8
lines changed

Package.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@
2121
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
// THE SOFTWARE.
2323

24+
// swift-tools-version:5.0
25+
// The swift-tools-version declares the minimum version of Swift required to build this package.
26+
2427
import PackageDescription
2528

26-
let package = Package(name: "UserDefaultsStore", dependencies: [], exclude: ["Tests"])
29+
let package = Package(
30+
name: "UserDefaultsStore",
31+
products: [
32+
.library(name: "UserDefaultsStore", targets: ["UserDefaultsStore"])
33+
],
34+
dependencies: [],
35+
targets: [
36+
.target(name: "UserDefaultsStore", dependencies: [])
37+
]
38+
)

README.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<a href="https://cocoapods.org/pods/UserDefaultsStore"><img src="https://img.shields.io/cocoapods/v/UserDefaultsStore.svg" alt="Cocoapods" /></a>
1111
<a href="https://github.com/Carthage/Carthage"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" alt="Carthage compatible" /></a>
1212
<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>
13-
<a href="https://swift.org"><img src="https://img.shields.io/badge/Swift-4.2-orange.svg" alt="Swift" /></a>
13+
<a href="https://swift.org"><img src="https://img.shields.io/badge/Swift-5-orange.svg" alt="Swift" /></a>
1414
<a href="https://developer.apple.com/xcode"><img src="https://img.shields.io/badge/Xcode-10-blue.svg" alt="Xcode"></a>
1515
<a href="https://github.com/omaralbeik/UserDefaultsStore/blob/master/LICENSE"><img src="https://img.shields.io/badge/License-MIT-red.svg" alt="MIT"></a>
1616
</p>
@@ -42,14 +42,27 @@ You love Swift's `Codable` protocol and use it everywhere, who doesn't! Here is
4242
<details>
4343
<summary>Swift Package Manager</summary>
4444
</br>
45-
<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>
46-
<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>
45+
<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>
4746

4847
<pre><code class="swift language-swift">import PackageDescription
49-
dependencies: [
50-
.package(url: "https://github.com/omaralbeik/UserDefaultsStore.git", from: "1.0.2")
51-
]
48+
49+
let package = Package(
50+
name: "YOUR_PROJECT_NAME",
51+
targets: [],
52+
dependencies: [
53+
.package(url: "https://github.com/omaralbeik/UserDefaultsStore.git", from: "1.4.1")
54+
]
55+
)
5256
</code></pre>
57+
58+
<p>Next, add <code>UserDefaultsStore</code> to your targets dependencies like so:</p>
59+
<pre><code class="swift language-swift">.target(
60+
name: "YOUR_TARGET_NAME",
61+
dependencies: [
62+
"UserDefaultsStore",
63+
]
64+
),</code></pre>
65+
<p>Then run <code>swift package update</code>.</p>
5366
</details>
5467

5568
<details>

Tests/SingleStoreTests.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ final class SingleStoreTests: XCTestCase {
3131
XCTAssertNotNil(store)
3232
}
3333

34+
func testCreateInvalidStore() {
35+
let invalidStore = SingleUserDefaultsStore<Bool>(uniqueIdentifier: UserDefaults.globalDomain)
36+
XCTAssertNil(invalidStore)
37+
}
38+
3439
func testSaveObject() {
3540
let store = createFreshUsersStore()!
3641

Tests/StoreTests.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ final class StoreTests: XCTestCase {
3131
XCTAssertNotNil(store)
3232
}
3333

34+
func testCreateInvalidStore() {
35+
let invalidStore = UserDefaultsStore<TestUser>(uniqueIdentifier: UserDefaults.globalDomain)
36+
XCTAssertNil(invalidStore)
37+
}
38+
3439
func testSaveObject() {
3540
let store = createFreshUsersStore()!
3641

UserDefaultsStore.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "UserDefaultsStore"
3-
s.version = "1.4"
3+
s.version = "1.4.1"
44
s.summary = "Why not use UserDefaults to store Codable objects 😉"
55
s.description = <<-DESC
66
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.

0 commit comments

Comments
 (0)