Skip to content

Commit

Permalink
[3.0.0] re-gen docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jessesquires committed Jan 24, 2022
1 parent f157dc9 commit a62d470
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 21 deletions.
4 changes: 2 additions & 2 deletions docs/Protocols.html
Expand Up @@ -17,7 +17,7 @@
<a title="Protocols Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">Foil 2.0.0 Docs</a> (100% documented)</p>
<p><a href="index.html">Foil 3.0.0 Docs</a> (100% documented)</p>
<p class="header-right"><a href="https://github.com/jessesquires/Foil"><img src="img/gh.png" alt="GitHub"/>View on GitHub</a></p>
<div class="header-right">
<form role="search" action="search.json">
Expand Down Expand Up @@ -118,7 +118,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2021 <a class="link" href="https://jessesquires.com" target="_blank" rel="external noopener">Jesse Squires</a>. All rights reserved. (Last updated: 2021-11-19)</p>
<p>&copy; 2022 <a class="link" href="https://jessesquires.com" target="_blank" rel="external noopener">Jesse Squires</a>. All rights reserved. (Last updated: 2022-01-24)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</article>
Expand Down
4 changes: 2 additions & 2 deletions docs/Protocols/UserDefaultsSerializable.html
Expand Up @@ -17,7 +17,7 @@
<a title="UserDefaultsSerializable Protocol Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">Foil 2.0.0 Docs</a> (100% documented)</p>
<p><a href="../index.html">Foil 3.0.0 Docs</a> (100% documented)</p>
<p class="header-right"><a href="https://github.com/jessesquires/Foil"><img src="../img/gh.png" alt="GitHub"/>View on GitHub</a></p>
<div class="header-right">
<form role="search" action="../search.json">
Expand Down Expand Up @@ -197,7 +197,7 @@ <h4>Parameters</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2021 <a class="link" href="https://jessesquires.com" target="_blank" rel="external noopener">Jesse Squires</a>. All rights reserved. (Last updated: 2021-11-19)</p>
<p>&copy; 2022 <a class="link" href="https://jessesquires.com" target="_blank" rel="external noopener">Jesse Squires</a>. All rights reserved. (Last updated: 2022-01-24)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</article>
Expand Down
4 changes: 2 additions & 2 deletions docs/Structs.html
Expand Up @@ -17,7 +17,7 @@
<a title="Structures Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">Foil 2.0.0 Docs</a> (100% documented)</p>
<p><a href="index.html">Foil 3.0.0 Docs</a> (100% documented)</p>
<p class="header-right"><a href="https://github.com/jessesquires/Foil"><img src="img/gh.png" alt="GitHub"/>View on GitHub</a></p>
<div class="header-right">
<form role="search" action="search.json">
Expand Down Expand Up @@ -132,7 +132,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2021 <a class="link" href="https://jessesquires.com" target="_blank" rel="external noopener">Jesse Squires</a>. All rights reserved. (Last updated: 2021-11-19)</p>
<p>&copy; 2022 <a class="link" href="https://jessesquires.com" target="_blank" rel="external noopener">Jesse Squires</a>. All rights reserved. (Last updated: 2022-01-24)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</article>
Expand Down
31 changes: 29 additions & 2 deletions docs/Structs/WrappedDefault.html
Expand Up @@ -17,7 +17,7 @@
<a title="WrappedDefault Structure Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">Foil 2.0.0 Docs</a> (100% documented)</p>
<p><a href="../index.html">Foil 3.0.0 Docs</a> (100% documented)</p>
<p class="header-right"><a href="https://github.com/jessesquires/Foil"><img src="../img/gh.png" alt="GitHub"/>View on GitHub</a></p>
<div class="header-right">
<form role="search" action="../search.json">
Expand Down Expand Up @@ -130,6 +130,33 @@ <h4>Declaration</h4>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:4Foil14WrappedDefaultV14projectedValue7Combine12AnyPublisherVyxs5NeverOGvp"></a>
<a name="//apple_ref/swift/Property/projectedValue" class="dashAnchor"></a>
<a class="token" href="#/s:4Foil14WrappedDefaultV14projectedValue7Combine12AnyPublisherVyxs5NeverOGvp">projectedValue</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A publisher that delivers updates to subscribers.</p>

</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">projectedValue</span><span class="p">:</span> <span class="kt">AnyPublisher</span><span class="o">&lt;</span><span class="kt">T</span><span class="p">,</span> <span class="kt">Never</span><span class="o">&gt;</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>

</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
Expand Down Expand Up @@ -205,7 +232,7 @@ <h4>Parameters</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2021 <a class="link" href="https://jessesquires.com" target="_blank" rel="external noopener">Jesse Squires</a>. All rights reserved. (Last updated: 2021-11-19)</p>
<p>&copy; 2022 <a class="link" href="https://jessesquires.com" target="_blank" rel="external noopener">Jesse Squires</a>. All rights reserved. (Last updated: 2022-01-24)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</article>
Expand Down
31 changes: 29 additions & 2 deletions docs/Structs/WrappedDefaultOptional.html
Expand Up @@ -17,7 +17,7 @@
<a title="WrappedDefaultOptional Structure Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">Foil 2.0.0 Docs</a> (100% documented)</p>
<p><a href="../index.html">Foil 3.0.0 Docs</a> (100% documented)</p>
<p class="header-right"><a href="https://github.com/jessesquires/Foil"><img src="../img/gh.png" alt="GitHub"/>View on GitHub</a></p>
<div class="header-right">
<form role="search" action="../search.json">
Expand Down Expand Up @@ -130,6 +130,33 @@ <h4>Declaration</h4>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:4Foil22WrappedDefaultOptionalV14projectedValue7Combine12AnyPublisherVyxSgs5NeverOGvp"></a>
<a name="//apple_ref/swift/Property/projectedValue" class="dashAnchor"></a>
<a class="token" href="#/s:4Foil22WrappedDefaultOptionalV14projectedValue7Combine12AnyPublisherVyxSgs5NeverOGvp">projectedValue</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A publisher that delivers updates to subscribers.</p>

</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">projectedValue</span><span class="p">:</span> <span class="kt">AnyPublisher</span><span class="o">&lt;</span><span class="kt">T</span><span class="p">?,</span> <span class="kt">Never</span><span class="o">&gt;</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>

</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
Expand Down Expand Up @@ -193,7 +220,7 @@ <h4>Parameters</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2021 <a class="link" href="https://jessesquires.com" target="_blank" rel="external noopener">Jesse Squires</a>. All rights reserved. (Last updated: 2021-11-19)</p>
<p>&copy; 2022 <a class="link" href="https://jessesquires.com" target="_blank" rel="external noopener">Jesse Squires</a>. All rights reserved. (Last updated: 2022-01-24)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</article>
Expand Down
34 changes: 24 additions & 10 deletions docs/index.html
Expand Up @@ -16,7 +16,7 @@
<a title="Foil Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">Foil 2.0.0 Docs</a> (100% documented)</p>
<p><a href="index.html">Foil 3.0.0 Docs</a> (100% documented)</p>
<p class="header-right"><a href="https://github.com/jessesquires/Foil"><img src="img/gh.png" alt="GitHub"/>View on GitHub</a></p>
<div class="header-right">
<form role="search" action="search.json">
Expand Down Expand Up @@ -70,7 +70,7 @@ <h2 id='about' class='heading'>About</h2>
<p>Read the post: <a href="https://www.jessesquires.com/blog/2021/03/26/a-better-approach-to-writing-a-userdefaults-property-wrapper/">A better approach to writing a UserDefaults Property Wrapper</a></p>
<h4 id='why-the-name' class='heading'>Why the name?</h4>

<p>Foil, as in let me quickly and easily <strong>wrap</strong> and <strong>store</strong> this leftover food in some <strong>foil</strong> so I can eat it later. 🌯 😉</p>
<p>Foil, as in &ldquo;let me quickly and easily <strong>wrap</strong> and <strong>store</strong> this leftover food in some <strong>foil</strong> so I can eat it later.&rdquo; 🌯 😉</p>

<blockquote>
<p><a href="https://www.wordnik.com/words/aluminum%20foil">Foil</a>:<br>
Expand Down Expand Up @@ -126,12 +126,15 @@ <h3 id='using-code-enum-code-keys' class='heading'>Using <code>enum</code> keys<
</code></pre>
<h3 id='observing-changes' class='heading'>Observing changes</h3>

<p>There are <a href="https://www.jessesquires.com/blog/2021/08/08/different-ways-to-observe-properties-in-swift/">many ways to observe property changes</a>. The most common are by using Key-Value Observing or a Combine Publisher. Both require the object with the property to inherit from <code>NSObject</code> and the property must be declared as <code>@objc dynamic</code>.</p>
<p>There are <a href="https://www.jessesquires.com/blog/2021/08/08/different-ways-to-observe-properties-in-swift/">many ways to observe property changes</a>. The most common are by using Key-Value Observing or a Combine Publisher. KVO observing requires the object with the property to inherit from <code>NSObject</code> and the property must be declared as <code>@objc dynamic</code>.</p>
<pre class="highlight swift"><code><span class="kd">final</span> <span class="kd">class</span> <span class="kt">AppSettings</span><span class="p">:</span> <span class="kt">NSObject</span> <span class="p">{</span>
<span class="kd">static</span> <span class="k">let</span> <span class="nv">shared</span> <span class="o">=</span> <span class="kt">AppSettings</span><span class="p">()</span>

<span class="kd">@WrappedDefaultOptional</span><span class="p">(</span><span class="nv">key</span><span class="p">:</span> <span class="s">"userId"</span><span class="p">)</span>
<span class="kd">@objc</span> <span class="kd">dynamic</span> <span class="k">var</span> <span class="nv">userId</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span>

<span class="kd">@WrappedDefaultOptional</span><span class="p">(</span><span class="nv">key</span><span class="p">:</span> <span class="s">"average"</span><span class="p">)</span>
<span class="k">var</span> <span class="nv">average</span><span class="p">:</span> <span class="kt">Double</span><span class="p">?</span>
<span class="p">}</span>
</code></pre>
<h4 id='using-kvo' class='heading'>Using KVO</h4>
Expand All @@ -140,6 +143,17 @@ <h4 id='using-kvo' class='heading'>Using KVO</h4>
<span class="p">}</span>
</code></pre>
<h4 id='using-combine' class='heading'>Using Combine</h4>

<p><strong>Note:</strong> that <code>average</code> does not need the <code>@objc dynamic</code> annotation, <code>.receiveValue</code> will fire immediately with the current value of <code>average</code> and on every change after.</p>
<pre class="highlight swift"><code><span class="kt">AppSettings</span><span class="o">.</span><span class="n">shared</span><span class="o">.</span><span class="err">$</span><span class="n">average</span>
<span class="o">.</span><span class="n">sink</span> <span class="p">{</span>
<span class="nf">print</span><span class="p">(</span><span class="nv">$0</span><span class="p">)</span>
<span class="p">}</span>
<span class="o">.</span><span class="nf">store</span><span class="p">(</span><span class="nv">in</span><span class="p">:</span> <span class="o">&amp;</span><span class="n">cancellable</span><span class="p">)</span>
</code></pre>
<h4 id='combine-alternative-with-kvo' class='heading'>Combine Alternative with KVO</h4>

<p><strong>Note:</strong> in this case, <code>userId</code> needs the <code>@objc dynamic</code> annotation and <code>AppSettings</code> needs to inherit from <code>NSObject</code>. Then <code>receiveValue</code> will fire only on changes to wrapped object&rsquo;s value. It will not publish the initial value as in the example above.</p>
<pre class="highlight swift"><code><span class="kt">AppSettings</span><span class="o">.</span><span class="n">shared</span>
<span class="o">.</span><span class="nf">publisher</span><span class="p">(</span><span class="nv">for</span><span class="p">:</span> <span class="p">\</span><span class="o">.</span><span class="n">userId</span><span class="p">,</span> <span class="nv">options</span><span class="p">:</span> <span class="p">[</span><span class="o">.</span><span class="k">new</span><span class="p">])</span>
<span class="o">.</span><span class="n">sink</span> <span class="p">{</span>
Expand Down Expand Up @@ -179,10 +193,10 @@ <h2 id='additional-resources' class='heading'>Additional Resources</h2>
<h2 id='supported-platforms' class='heading'>Supported Platforms</h2>

<ul>
<li>iOS 9.0+</li>
<li>tvOS 9.0+</li>
<li>watchOS 5.0+</li>
<li>macOS 10.13+</li>
<li>iOS 13.0+</li>
<li>tvOS 13.0+</li>
<li>watchOS 6.0+</li>
<li>macOS 11+</li>
</ul>
<h2 id='requirements' class='heading'>Requirements</h2>

Expand All @@ -193,11 +207,11 @@ <h2 id='requirements' class='heading'>Requirements</h2>
</ul>
<h2 id='installation' class='heading'>Installation</h2>
<h3 id='a-href-http-cocoapods-org-cocoapods-a' class='heading'><a href="http://cocoapods.org">CocoaPods</a></h3>
<pre class="highlight ruby"><code><span class="n">pod</span> <span class="s1">'Foil'</span><span class="p">,</span> <span class="s1">'~&gt; 2.0.0'</span>
<pre class="highlight ruby"><code><span class="n">pod</span> <span class="s1">'Foil'</span><span class="p">,</span> <span class="s1">'~&gt; 3.0.0'</span>
</code></pre>
<h3 id='a-href-https-swift-org-package-manager-swift-package-manager-a' class='heading'><a href="https://swift.org/package-manager/">Swift Package Manager</a></h3>
<pre class="highlight swift"><code><span class="nv">dependencies</span><span class="p">:</span> <span class="p">[</span>
<span class="o">.</span><span class="nf">package</span><span class="p">(</span><span class="nv">url</span><span class="p">:</span> <span class="s">"https://github.com/jessesquires/Foil.git"</span><span class="p">,</span> <span class="nv">from</span><span class="p">:</span> <span class="s">"2.0.0"</span><span class="p">)</span>
<span class="o">.</span><span class="nf">package</span><span class="p">(</span><span class="nv">url</span><span class="p">:</span> <span class="s">"https://github.com/jessesquires/Foil.git"</span><span class="p">,</span> <span class="nv">from</span><span class="p">:</span> <span class="s">"3.0.0"</span><span class="p">)</span>
<span class="p">]</span>
</code></pre>

Expand Down Expand Up @@ -231,7 +245,7 @@ <h2 id='license' class='heading'>License</h2>
</section>
</section>
<section id="footer">
<p>&copy; 2021 <a class="link" href="https://jessesquires.com" target="_blank" rel="external noopener">Jesse Squires</a>. All rights reserved. (Last updated: 2021-11-19)</p>
<p>&copy; 2022 <a class="link" href="https://jessesquires.com" target="_blank" rel="external noopener">Jesse Squires</a>. All rights reserved. (Last updated: 2022-01-24)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</article>
Expand Down

0 comments on commit a62d470

Please sign in to comment.