Skip to content

Commit

Permalink
[master] - 'Documentation update! - TT'
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyler-Keith-Thompson committed Nov 8, 2019
1 parent 29c5b9e commit 70fea4d
Show file tree
Hide file tree
Showing 38 changed files with 1,224 additions and 295 deletions.
15 changes: 15 additions & 0 deletions Workflow/Models/PresentationType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,18 @@ public enum PresentationType:Int {
/// - Note: If there's already a navigation stack, it will be used. Otherwise views will present modally
case `default`
}

/**
ViewPersistance: An enum that indicates how FlowRepresentables should be persist when in the view stack

### Discussion:
Used when you are creating a workflow
*/
public enum ViewPersistance {
/// default: Indicates a `FlowRepresentable` in a `Workflow` should persist in the viewstack based on it's `shouldLoad` function
case `default`
/// default: Indicates a `FlowRepresentable` in a `Workflow` who's `shouldLoad` function returns false should still be in the viewstack so if a user navigates backwards it'll appear
case hiddenInitially
/// default: Indicates a `FlowRepresentable` in a `Workflow` who's `shouldLoad` function returns true should be removed from the viewstack after the user progresses past it
case removedAfterProceeding
}
30 changes: 18 additions & 12 deletions Workflow/Workflow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ import Foundation
}
```
*/

public enum ViewPersistance {
case `default`
case hiddenInitially
case removedAfterProceeding
}
public class Workflow: LinkedList<FlowRepresentableMetaData>, ExpressibleByArrayLiteral {
public typealias ArrayLiteralElement = AnyFlowRepresentable.Type
internal var instances = LinkedList<AnyFlowRepresentable?>()
Expand Down Expand Up @@ -79,32 +73,44 @@ public class Workflow: LinkedList<FlowRepresentableMetaData>, ExpressibleByArray
presenter = nil
}

public func thenPresent<F>(_ type:F.Type, staysInViewStack:@escaping @autoclosure () -> ViewPersistance = .default, preferredLaunchStyle:PresentationType = .default) -> Workflow where F: FlowRepresentable {
/// thenPresent: A way of creating workflows with a fluid API. Useful for complex workflows with difficult requirements
/// - Parameter type: A reference to the class used to create the workflow
/// - Parameter staysInViewStack: An `ViewPersistance`type representing how this item in the workflow should persist.
/// - Returns: `Workflow`
public func thenPresent<F>(_ type:F.Type, staysInViewStack:@escaping @autoclosure () -> ViewPersistance = .default) -> Workflow where F: FlowRepresentable {
let wf = Workflow(first)
wf.append(FlowRepresentableMetaData(type,
staysInViewStack: { _ in staysInViewStack() },
presentationType: preferredLaunchStyle))
presentationType: .default))
return wf
}

public func thenPresent<F>(_ type:F.Type, staysInViewStack:@escaping (F.IntakeType) -> ViewPersistance, preferredLaunchStyle:PresentationType = .default) -> Workflow where F: FlowRepresentable {
/// thenPresent: A way of creating workflows with a fluid API. Useful for complex workflows with difficult requirements
/// - Parameter type: A reference to the class used to create the workflow
/// - Parameter staysInViewStack: A closure taking in the generic type from the `FlowRepresentable` and returning a `ViewPersistance`type representing how this item in the workflow should persist.
/// - Returns: `Workflow`
public func thenPresent<F>(_ type:F.Type, staysInViewStack:@escaping (F.IntakeType) -> ViewPersistance) -> Workflow where F: FlowRepresentable {
let wf = Workflow(first)
wf.append(FlowRepresentableMetaData(type,
staysInViewStack: { data in
guard let cast = data as? F.IntakeType else { return .default }
return staysInViewStack(cast)
},
presentationType: preferredLaunchStyle))
presentationType: .default))
return wf
}

public func thenPresent<F>(_ type:F.Type, staysInViewStack:@escaping () -> ViewPersistance, preferredLaunchStyle:PresentationType = .default) -> Workflow where F: FlowRepresentable, F.IntakeType == Never {
/// thenPresent: A way of creating workflows with a fluid API. Useful for complex workflows with difficult requirements
/// - Parameter type: A reference to the class used to create the workflow
/// - Parameter staysInViewStack: A closure returning a `ViewPersistance`type representing how this item in the workflow should persist.
/// - Returns: `Workflow`
public func thenPresent<F>(_ type:F.Type, staysInViewStack:@escaping () -> ViewPersistance) -> Workflow where F: FlowRepresentable, F.IntakeType == Never {
let wf = Workflow(first)
wf.append(FlowRepresentableMetaData(type,
staysInViewStack: { _ in
return staysInViewStack()
},
presentationType: preferredLaunchStyle))
presentationType: .default))
return wf
}

Expand Down
11 changes: 7 additions & 4 deletions docs/Classes.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<a title="Classes Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">DynamicWorkflow Docs</a> (77% documented)</p>
<p><a href="index.html">DynamicWorkflow Docs</a> (74% documented)</p>
</div>
</header>
<div class="content-wrapper">
Expand Down Expand Up @@ -50,6 +50,9 @@
<li class="nav-group-task">
<a href="Enums/PresentationType.html">PresentationType</a>
</li>
<li class="nav-group-task">
<a href="Enums/ViewPersistance.html">ViewPersistance</a>
</li>
</ul>
</li>
<li class="nav-group-name">
Expand Down Expand Up @@ -110,7 +113,7 @@ <h3 id='discussion' class='heading'>Discussion:</h3>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">LinkedList</span><span class="o">&lt;</span><span class="kt">Value</span><span class="o">&gt;</span> <span class="p">:</span> <span class="kt">Sequence</span><span class="p">,</span> <span class="kt">ExpressibleByArrayLiteral</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">LinkedList</span><span class="o">&lt;</span><span class="kt">Value</span><span class="o">&gt;</span> <span class="p">:</span> <span class="kt">Sequence</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>

</div>
</div>
Expand Down Expand Up @@ -218,7 +221,7 @@ <h3 id='discussion' class='heading'>Discussion:</h3>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">Workflow</span> <span class="p">:</span> <span class="kt"><a href="Classes/LinkedList.html">LinkedList</a></span><span class="o">&lt;</span><span class="kt"><a href="Protocols/AnyFlowRepresentable.html">AnyFlowRepresentable</a></span><span class="o">.</span><span class="k">Type</span><span class="o">&gt;</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">Workflow</span> <span class="p">:</span> <span class="kt"><a href="Classes/LinkedList.html">LinkedList</a></span><span class="o">&lt;</span><span class="kt">FlowRepresentableMetaData</span><span class="o">&gt;</span><span class="p">,</span> <span class="kt">ExpressibleByArrayLiteral</span></code></pre>

</div>
</div>
Expand All @@ -230,7 +233,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="https://github.com/Tyler-Keith-Thompson/Workflow" target="_blank" rel="external">Tyler.Thompson</a>. All rights reserved. (Last updated: 2019-10-20)</p>
<p>&copy; 2019 <a class="link" href="https://github.com/Tyler-Keith-Thompson/Workflow" target="_blank" rel="external">Tyler.Thompson</a>. All rights reserved. (Last updated: 2019-11-07)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.11.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Expand Down
101 changes: 7 additions & 94 deletions docs/Classes/LinkedList.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<a title="LinkedList Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">DynamicWorkflow Docs</a> (77% documented)</p>
<p><a href="../index.html">DynamicWorkflow Docs</a> (74% documented)</p>
</div>
</header>
<div class="content-wrapper">
Expand Down Expand Up @@ -50,6 +50,9 @@
<li class="nav-group-task">
<a href="../Enums/PresentationType.html">PresentationType</a>
</li>
<li class="nav-group-task">
<a href="../Enums/ViewPersistance.html">ViewPersistance</a>
</li>
</ul>
</li>
<li class="nav-group-name">
Expand Down Expand Up @@ -82,7 +85,7 @@
<h1>LinkedList</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">LinkedList</span><span class="o">&lt;</span><span class="kt">Value</span><span class="o">&gt;</span> <span class="p">:</span> <span class="kt">Sequence</span><span class="p">,</span> <span class="kt">ExpressibleByArrayLiteral</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">LinkedList</span><span class="o">&lt;</span><span class="kt">Value</span><span class="o">&gt;</span> <span class="p">:</span> <span class="kt">Sequence</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>

</div>
</div>
Expand Down Expand Up @@ -361,96 +364,6 @@ <h4>Declaration</h4>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:15DynamicWorkflow10LinkedListC12arrayLiteralACyxGxd_tcfc"></a>
<a name="//apple_ref/swift/Method/init(arrayLiteral:)" class="dashAnchor"></a>
<a class="token" href="#/s:15DynamicWorkflow10LinkedListC12arrayLiteralACyxGxd_tcfc">init(arrayLiteral:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>init(arrayLiteral): A LinkedList can be instantiated with an array literal
### Example:</p>
<pre class="highlight swift"><code> <span class="k">let</span> <span class="nv">list</span><span class="p">:</span><span class="kt">LinkedList</span><span class="o">&lt;</span><span class="kt">Int</span><span class="o">&gt;</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">]</span>
</code></pre>

</div>
<div class="declaration">
<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="kd">convenience</span> <span class="nf">init</span><span class="p">(</span><span class="n">arrayLiteral</span> <span class="nv">elements</span><span class="p">:</span> <span class="kt">Value</span><span class="o">...</span><span class="p">)</span></code></pre>

</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:15DynamicWorkflow10LinkedListCyACyxGxd_tcfc"></a>
<a name="//apple_ref/swift/Method/init(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:15DynamicWorkflow10LinkedListCyACyxGxd_tcfc">init(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>init(elements): A LinkedList can be instantiated with variadic arguments
### Example:</p>
<pre class="highlight swift"><code> <span class="k">let</span> <span class="nv">list</span> <span class="o">=</span> <span class="kt">LinkedList</span><span class="o">&lt;</span><span class="kt">Int</span><span class="o">&gt;</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
</code></pre>

</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="kd">convenience</span> <span class="nf">init</span><span class="p">(</span><span class="n">_</span> <span class="nv">elements</span><span class="p">:</span> <span class="kt">Value</span><span class="o">...</span><span class="p">)</span></code></pre>

</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:15DynamicWorkflow10LinkedListCyACyxGSayxGcfc"></a>
<a name="//apple_ref/swift/Method/init(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:15DynamicWorkflow10LinkedListCyACyxGSayxGcfc">init(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>init(elements): A LinkedList can be instantiated with an array
### Example:</p>
<pre class="highlight swift"><code> <span class="k">let</span> <span class="nv">list</span> <span class="o">=</span> <span class="kt">LinkedList</span><span class="o">&lt;</span><span class="kt">Int</span><span class="o">&gt;</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">])</span>
</code></pre>

</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="kd">convenience</span> <span class="nf">init</span><span class="p">(</span><span class="n">_</span> <span class="nv">elements</span><span class="p">:</span> <span class="p">[</span><span class="kt">Value</span><span class="p">])</span></code></pre>

</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
Expand Down Expand Up @@ -497,7 +410,7 @@ <h4>Declaration</h4>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">makeIterator</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="kt">LinkedList</span><span class="o">&lt;</span><span class="kt">Value</span><span class="o">&gt;.</span><span class="kt">LinkedListIterator</span><span class="o">&lt;</span><span class="kt">LinkedList</span><span class="o">&lt;</span><span class="kt">Value</span><span class="o">&gt;.</span><span class="kt"><a href="../Classes/LinkedList/Node.html">Node</a></span><span class="o">&lt;</span><span class="kt">Value</span><span class="o">&gt;&gt;</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">makeIterator</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/LinkedList.html#/s:ST8IteratorQa">Iterator</a></span></code></pre>

</div>
</div>
Expand Down Expand Up @@ -1859,7 +1772,7 @@ <h4>Return Value</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="https://github.com/Tyler-Keith-Thompson/Workflow" target="_blank" rel="external">Tyler.Thompson</a>. All rights reserved. (Last updated: 2019-10-20)</p>
<p>&copy; 2019 <a class="link" href="https://github.com/Tyler-Keith-Thompson/Workflow" target="_blank" rel="external">Tyler.Thompson</a>. All rights reserved. (Last updated: 2019-11-07)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.11.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Expand Down
Loading

0 comments on commit 70fea4d

Please sign in to comment.