Skip to content

Commit

Permalink
v0.3.1 (#8)
Browse files Browse the repository at this point in the history
* [fix] Fix initialObject/s overriding old values in stores

* [release] Bump version to 0.3.1

* [docs] Update docs to v0.3.1
  • Loading branch information
omaralbeik authored Oct 26, 2018
1 parent 5c1717f commit 0c9cf16
Show file tree
Hide file tree
Showing 34 changed files with 184 additions and 88 deletions.
2 changes: 1 addition & 1 deletion PersistenceKit.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "PersistenceKit"
s.version = "0.3"
s.version = "0.3.1"
s.summary = "
Store and retrieve Codable objects to various persistence layers, in a couple lines of code! "
s.description = <<-DESC
Expand Down
6 changes: 3 additions & 3 deletions Sources/Files/FilesStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ open class FilesStore<T: Codable & Identifiable> {
/// - initialObjects: optional objects array to save to store initially. _default is `nil`_
required public init(uniqueIdentifier: String, initialObjects: [T]? = nil) {
self.uniqueIdentifier = uniqueIdentifier
if let objects = initialObjects {
try? save(objects)
}
guard objectsCount == 0 else { return }
guard let objects = initialObjects else { return }
try? save(objects)
}

/// Save object to store.
Expand Down
6 changes: 3 additions & 3 deletions Sources/Files/SingleFilesStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ open class SingleFilesStore<T: Codable> {
/// - initialObject: optional object to save to store initially. _default is `nil`_
required public init(uniqueIdentifier: String, initialObject: T? = nil) {
self.uniqueIdentifier = uniqueIdentifier
if let object = initialObject {
try? save(object)
}
guard !hasObject else { return }
guard let object = initialObject else { return }
try? save(object)
}

/// Save object to store.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.3</string>
<string>0.3.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
6 changes: 3 additions & 3 deletions Sources/UserDefaults/SingleUserDefaultsStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ open class SingleUserDefaultsStore<T: Codable> {
guard let store = UserDefaults(suiteName: uniqueIdentifier) else { return nil }
self.uniqueIdentifier = uniqueIdentifier
self.store = store
if let object = initialObject {
try? save(object)
}
guard !hasObject else { return }
guard let object = initialObject else { return }
try? save(object)
}

/// Save object to store.
Expand Down
6 changes: 3 additions & 3 deletions Sources/UserDefaults/UserDefaultsStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ open class UserDefaultsStore<T: Codable & Identifiable> {
guard let store = UserDefaults(suiteName: uniqueIdentifier) else { return nil }
self.uniqueIdentifier = uniqueIdentifier
self.store = store
if let objects = initialObjects {
try? save(objects)
}
guard objectsCount == 0 else { return }
guard let objects = initialObjects else { return }
try? save(objects)
}

/// Save object to store.
Expand Down
2 changes: 1 addition & 1 deletion docs/Classes.html
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="https://github.com/Teknasyon-Teknoloji/PersistenceKit" target="_blank" rel="external">Omar Albeik</a>. All rights reserved. (Last updated: 2018-10-24)</p>
<p>&copy; 2018 <a class="link" href="https://github.com/Teknasyon-Teknoloji/PersistenceKit" target="_blank" rel="external">Omar Albeik</a>. All rights reserved. (Last updated: 2018-10-26)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
Expand Down
22 changes: 17 additions & 5 deletions docs/Classes/FilesStore.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ <h4>Declaration</h4>
<li class="item">
<div>
<code>
<a name="/s:14PersistenceKit10FilesStoreC16uniqueIdentifierACyxGSS_tcfc"></a>
<a name="//apple_ref/swift/Method/init(uniqueIdentifier:)" class="dashAnchor"></a>
<a class="token" href="#/s:14PersistenceKit10FilesStoreC16uniqueIdentifierACyxGSS_tcfc">init(uniqueIdentifier:)</a>
<a name="/s:14PersistenceKit10FilesStoreC16uniqueIdentifier14initialObjectsACyxGSS_SayxGSgtcfc"></a>
<a name="//apple_ref/swift/Method/init(uniqueIdentifier:initialObjects:)" class="dashAnchor"></a>
<a class="token" href="#/s:14PersistenceKit10FilesStoreC16uniqueIdentifier14initialObjectsACyxGSS_SayxGSgtcfc">init(uniqueIdentifier:initialObjects:)</a>
</code>
</div>
<div class="height-container">
Expand All @@ -210,7 +210,7 @@ <h4>Declaration</h4>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">required</span> <span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">uniqueIdentifier</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">required</span> <span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">uniqueIdentifier</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">initialObjects</span><span class="p">:</span> <span class="p">[</span><span class="kt">T</span><span class="p">]?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>

</div>
</div>
Expand All @@ -230,6 +230,18 @@ <h4>Parameters</h4>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>initialObjects</em>
</code>
</td>
<td>
<div>
<p>optional objects array to save to store initially. <em>default is <code>nil</code></em></p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
Expand Down Expand Up @@ -770,7 +782,7 @@ <h4>Parameters</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="https://github.com/Teknasyon-Teknoloji/PersistenceKit" target="_blank" rel="external">Omar Albeik</a>. All rights reserved. (Last updated: 2018-10-24)</p>
<p>&copy; 2018 <a class="link" href="https://github.com/Teknasyon-Teknoloji/PersistenceKit" target="_blank" rel="external">Omar Albeik</a>. All rights reserved. (Last updated: 2018-10-26)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
Expand Down
22 changes: 17 additions & 5 deletions docs/Classes/SingleFilesStore.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ <h4>Declaration</h4>
<li class="item">
<div>
<code>
<a name="/s:14PersistenceKit16SingleFilesStoreC16uniqueIdentifierACyxGSS_tcfc"></a>
<a name="//apple_ref/swift/Method/init(uniqueIdentifier:)" class="dashAnchor"></a>
<a class="token" href="#/s:14PersistenceKit16SingleFilesStoreC16uniqueIdentifierACyxGSS_tcfc">init(uniqueIdentifier:)</a>
<a name="/s:14PersistenceKit16SingleFilesStoreC16uniqueIdentifier13initialObjectACyxGSS_xSgtcfc"></a>
<a name="//apple_ref/swift/Method/init(uniqueIdentifier:initialObject:)" class="dashAnchor"></a>
<a class="token" href="#/s:14PersistenceKit16SingleFilesStoreC16uniqueIdentifier13initialObjectACyxGSS_xSgtcfc">init(uniqueIdentifier:initialObject:)</a>
</code>
</div>
<div class="height-container">
Expand All @@ -210,7 +210,7 @@ <h4>Declaration</h4>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">required</span> <span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">uniqueIdentifier</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">required</span> <span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">uniqueIdentifier</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">initialObject</span><span class="p">:</span> <span class="kt">T</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>

</div>
</div>
Expand All @@ -230,6 +230,18 @@ <h4>Parameters</h4>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>initialObject</em>
</code>
</td>
<td>
<div>
<p>optional object to save to store initially. <em>default is <code>nil</code></em></p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
Expand Down Expand Up @@ -427,7 +439,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="https://github.com/Teknasyon-Teknoloji/PersistenceKit" target="_blank" rel="external">Omar Albeik</a>. All rights reserved. (Last updated: 2018-10-24)</p>
<p>&copy; 2018 <a class="link" href="https://github.com/Teknasyon-Teknoloji/PersistenceKit" target="_blank" rel="external">Omar Albeik</a>. All rights reserved. (Last updated: 2018-10-26)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/Classes/SingleKeychainStore.html
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ <h4>Parameters</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="https://github.com/Teknasyon-Teknoloji/PersistenceKit" target="_blank" rel="external">Omar Albeik</a>. All rights reserved. (Last updated: 2018-10-24)</p>
<p>&copy; 2018 <a class="link" href="https://github.com/Teknasyon-Teknoloji/PersistenceKit" target="_blank" rel="external">Omar Albeik</a>. All rights reserved. (Last updated: 2018-10-26)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
Expand Down
24 changes: 18 additions & 6 deletions docs/Classes/SingleUserDefaultsStore.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ <h4>Declaration</h4>
<li class="item">
<div>
<code>
<a name="/s:14PersistenceKit23SingleUserDefaultsStoreC16uniqueIdentifierACyxGSgSS_tcfc"></a>
<a name="//apple_ref/swift/Method/init(uniqueIdentifier:)" class="dashAnchor"></a>
<a class="token" href="#/s:14PersistenceKit23SingleUserDefaultsStoreC16uniqueIdentifierACyxGSgSS_tcfc">init(uniqueIdentifier:)</a>
<a name="/s:14PersistenceKit23SingleUserDefaultsStoreC16uniqueIdentifier13initialObjectACyxGSgSS_xSgtcfc"></a>
<a name="//apple_ref/swift/Method/init(uniqueIdentifier:initialObject:)" class="dashAnchor"></a>
<a class="token" href="#/s:14PersistenceKit23SingleUserDefaultsStoreC16uniqueIdentifier13initialObjectACyxGSgSS_xSgtcfc">init(uniqueIdentifier:initialObject:)</a>
</code>
</div>
<div class="height-container">
Expand All @@ -210,7 +210,7 @@ <h4>Declaration</h4>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">required</span> <span class="kd">public</span> <span class="nf">init</span><span class="p">?(</span><span class="nv">uniqueIdentifier</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">required</span> <span class="kd">public</span> <span class="nf">init</span><span class="p">?(</span><span class="nv">uniqueIdentifier</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">initialObject</span><span class="p">:</span> <span class="kt">T</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>

</div>
</div>
Expand All @@ -226,7 +226,19 @@ <h4>Parameters</h4>
</td>
<td>
<div>
<p>store&rsquo;s unique identifier.</p>
<p>uniqueIdentifier: store&rsquo;s unique identifier.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>initialObject</em>
</code>
</td>
<td>
<div>
<p>optional object to save to store initially. <em>default is <code>nil</code></em></p>
</div>
</td>
</tr>
Expand Down Expand Up @@ -427,7 +439,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="https://github.com/Teknasyon-Teknoloji/PersistenceKit" target="_blank" rel="external">Omar Albeik</a>. All rights reserved. (Last updated: 2018-10-24)</p>
<p>&copy; 2018 <a class="link" href="https://github.com/Teknasyon-Teknoloji/PersistenceKit" target="_blank" rel="external">Omar Albeik</a>. All rights reserved. (Last updated: 2018-10-26)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
Expand Down
24 changes: 18 additions & 6 deletions docs/Classes/UserDefaultsStore.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ <h4>Declaration</h4>
<li class="item">
<div>
<code>
<a name="/s:14PersistenceKit17UserDefaultsStoreC16uniqueIdentifierACyxGSgSS_tcfc"></a>
<a name="//apple_ref/swift/Method/init(uniqueIdentifier:)" class="dashAnchor"></a>
<a class="token" href="#/s:14PersistenceKit17UserDefaultsStoreC16uniqueIdentifierACyxGSgSS_tcfc">init(uniqueIdentifier:)</a>
<a name="/s:14PersistenceKit17UserDefaultsStoreC16uniqueIdentifier14initialObjectsACyxGSgSS_SayxGSgtcfc"></a>
<a name="//apple_ref/swift/Method/init(uniqueIdentifier:initialObjects:)" class="dashAnchor"></a>
<a class="token" href="#/s:14PersistenceKit17UserDefaultsStoreC16uniqueIdentifier14initialObjectsACyxGSgSS_SayxGSgtcfc">init(uniqueIdentifier:initialObjects:)</a>
</code>
</div>
<div class="height-container">
Expand All @@ -210,7 +210,7 @@ <h4>Declaration</h4>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">required</span> <span class="kd">public</span> <span class="nf">init</span><span class="p">?(</span><span class="nv">uniqueIdentifier</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">required</span> <span class="kd">public</span> <span class="nf">init</span><span class="p">?(</span><span class="nv">uniqueIdentifier</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">initialObjects</span><span class="p">:</span> <span class="p">[</span><span class="kt">T</span><span class="p">]?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>

</div>
</div>
Expand All @@ -226,7 +226,19 @@ <h4>Parameters</h4>
</td>
<td>
<div>
<p>store&rsquo;s unique identifier.</p>
<p>uniqueIdentifier: store&rsquo;s unique identifier.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>initialObjects</em>
</code>
</td>
<td>
<div>
<p>optional objects array to save to store initially. <em>default is <code>nil</code></em></p>
</div>
</td>
</tr>
Expand Down Expand Up @@ -770,7 +782,7 @@ <h4>Parameters</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="https://github.com/Teknasyon-Teknoloji/PersistenceKit" target="_blank" rel="external">Omar Albeik</a>. All rights reserved. (Last updated: 2018-10-24)</p>
<p>&copy; 2018 <a class="link" href="https://github.com/Teknasyon-Teknoloji/PersistenceKit" target="_blank" rel="external">Omar Albeik</a>. All rights reserved. (Last updated: 2018-10-26)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/Enums.html
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="https://github.com/Teknasyon-Teknoloji/PersistenceKit" target="_blank" rel="external">Omar Albeik</a>. All rights reserved. (Last updated: 2018-10-24)</p>
<p>&copy; 2018 <a class="link" href="https://github.com/Teknasyon-Teknoloji/PersistenceKit" target="_blank" rel="external">Omar Albeik</a>. All rights reserved. (Last updated: 2018-10-26)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/Enums/KeychainAccessibilityOption.html
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="https://github.com/Teknasyon-Teknoloji/PersistenceKit" target="_blank" rel="external">Omar Albeik</a>. All rights reserved. (Last updated: 2018-10-24)</p>
<p>&copy; 2018 <a class="link" href="https://github.com/Teknasyon-Teknoloji/PersistenceKit" target="_blank" rel="external">Omar Albeik</a>. All rights reserved. (Last updated: 2018-10-26)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
Expand Down
Loading

0 comments on commit 0c9cf16

Please sign in to comment.