diff --git a/Workflow/Models/PresentationType.swift b/Workflow/Models/PresentationType.swift index ce0bd2fe7..8904d6bab 100644 --- a/Workflow/Models/PresentationType.swift +++ b/Workflow/Models/PresentationType.swift @@ -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 +} diff --git a/Workflow/Workflow.swift b/Workflow/Workflow.swift index 2e99cfeb3..5fb58bc94 100644 --- a/Workflow/Workflow.swift +++ b/Workflow/Workflow.swift @@ -29,12 +29,6 @@ import Foundation } ``` */ - -public enum ViewPersistance { - case `default` - case hiddenInitially - case removedAfterProceeding -} public class Workflow: LinkedList, ExpressibleByArrayLiteral { public typealias ArrayLiteralElement = AnyFlowRepresentable.Type internal var instances = LinkedList() @@ -79,32 +73,44 @@ public class Workflow: LinkedList, ExpressibleByArray presenter = nil } - public func thenPresent(_ 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(_ 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(_ 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(_ 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(_ 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(_ 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 } diff --git a/docs/Classes.html b/docs/Classes.html index 38ca74b1f..4f7757c29 100644 --- a/docs/Classes.html +++ b/docs/Classes.html @@ -14,7 +14,7 @@
-

DynamicWorkflow Docs (77% documented)

+

DynamicWorkflow Docs (74% documented)

@@ -50,6 +50,9 @@ +
@@ -218,7 +221,7 @@

Discussion:

Declaration

Swift

-
public class Workflow : LinkedList<AnyFlowRepresentable.Type>
+
public class Workflow : LinkedList<FlowRepresentableMetaData>, ExpressibleByArrayLiteral
@@ -230,7 +233,7 @@

Declaration

diff --git a/docs/Classes/LinkedList.html b/docs/Classes/LinkedList.html index 7842217ec..7402a1ec3 100644 --- a/docs/Classes/LinkedList.html +++ b/docs/Classes/LinkedList.html @@ -14,7 +14,7 @@
-

DynamicWorkflow Docs (77% documented)

+

DynamicWorkflow Docs (74% documented)

@@ -50,6 +50,9 @@ +
-
  • -
    - - - - init(arrayLiteral:) - -
    -
    -
    -
    -
    -
    -

    init(arrayLiteral): A LinkedList can be instantiated with an array literal - ### Example:

    -
     let list:LinkedList<Int> = [1, 2, 3, 4]
    -
    - -
    -
    -

    Declaration

    -
    -

    Swift

    -
    required public convenience init(arrayLiteral elements: Value...)
    - -
    -
    -
    -
    -
  • -
  • -
    - - - - init(_:) - -
    -
    -
    -
    -
    -
    -

    init(elements): A LinkedList can be instantiated with variadic arguments - ### Example:

    -
     let list = LinkedList<Int>(1, 2, 3, 4)
    -
    - -
    -
    -

    Declaration

    -
    -

    Swift

    -
    public convenience init(_ elements: Value...)
    - -
    -
    -
    -
    -
  • -
  • -
    - - - - init(_:) - -
    -
    -
    -
    -
    -
    -

    init(elements): A LinkedList can be instantiated with an array - ### Example:

    -
     let list = LinkedList<Int>([1, 2, 3, 4])
    -
    - -
    -
    -

    Declaration

    -
    -

    Swift

    -
    public convenience init(_ elements: [Value])
    - -
    -
    -
    -
    -
  • @@ -497,7 +410,7 @@

    Declaration

    Declaration

    Swift

    -
    public func makeIterator() -> LinkedList<Value>.LinkedListIterator<LinkedList<Value>.Node<Value>>
    +
    public func makeIterator() -> Iterator
    @@ -1859,7 +1772,7 @@

    Return Value

    diff --git a/docs/Classes/LinkedList/Node.html b/docs/Classes/LinkedList/Node.html index 7907e37d5..2022f55fd 100644 --- a/docs/Classes/LinkedList/Node.html +++ b/docs/Classes/LinkedList/Node.html @@ -14,7 +14,7 @@
    -

    DynamicWorkflow Docs (77% documented)

    +

    DynamicWorkflow Docs (74% documented)

    @@ -50,6 +50,9 @@
  • + + + +
  • +
    + + + + ViewPersistance + +
    +
    +
    +
    +
    +
    +

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

    +

    Discussion:

    + +

    Used when you are creating a workflow

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum ViewPersistance
    + +
    +
    +
    +
    +
  • diff --git a/docs/Enums/PresentationType.html b/docs/Enums/PresentationType.html index 592303b39..631f1edd4 100644 --- a/docs/Enums/PresentationType.html +++ b/docs/Enums/PresentationType.html @@ -14,7 +14,7 @@
    -

    DynamicWorkflow Docs (77% documented)

    +

    DynamicWorkflow Docs (74% documented)

    @@ -50,6 +50,9 @@ +
    + diff --git a/docs/Extensions.html b/docs/Extensions.html index 7cafaef19..22df1fcf4 100644 --- a/docs/Extensions.html +++ b/docs/Extensions.html @@ -14,7 +14,7 @@
    -

    DynamicWorkflow Docs (77% documented)

    +

    DynamicWorkflow Docs (74% documented)

    @@ -50,6 +50,9 @@ + + + + + +
  • - - - launch(view:from:withLaunchStyle:) + + + launch(view:from:withLaunchStyle:animated:completion:) Default implementation @@ -149,7 +152,7 @@

    Default Implementation

    Declaration

    Swift

    -
    func launch(view: ViewType, from root: ViewType, withLaunchStyle launchStyle: PresentationType)
    +
    func launch(view:ViewType, from root:ViewType, withLaunchStyle launchStyle: PresentationType, animated:Bool, completion:@escaping () -> Void)
    @@ -204,7 +207,7 @@

    Parameters

    diff --git a/docs/badge.svg b/docs/badge.svg index f6985a8a7..8f2e1c0c2 100644 --- a/docs/badge.svg +++ b/docs/badge.svg @@ -19,10 +19,10 @@ documentation - 77% + 74% - 77% + 74% diff --git a/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/Classes.html b/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/Classes.html index 38ca74b1f..4f7757c29 100644 --- a/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/Classes.html +++ b/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/Classes.html @@ -14,7 +14,7 @@
    -

    DynamicWorkflow Docs (77% documented)

    +

    DynamicWorkflow Docs (74% documented)

    @@ -50,6 +50,9 @@
  • +
    @@ -218,7 +221,7 @@

    Discussion:

    Declaration

    Swift

    -
    public class Workflow : LinkedList<AnyFlowRepresentable.Type>
    +
    public class Workflow : LinkedList<FlowRepresentableMetaData>, ExpressibleByArrayLiteral
    @@ -230,7 +233,7 @@

    Declaration

    diff --git a/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/Classes/LinkedList.html b/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/Classes/LinkedList.html index 7842217ec..7402a1ec3 100644 --- a/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/Classes/LinkedList.html +++ b/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/Classes/LinkedList.html @@ -14,7 +14,7 @@
    -

    DynamicWorkflow Docs (77% documented)

    +

    DynamicWorkflow Docs (74% documented)

    @@ -50,6 +50,9 @@ +
    -
  • -
    - - - - init(arrayLiteral:) - -
    -
    -
    -
    -
    -
    -

    init(arrayLiteral): A LinkedList can be instantiated with an array literal - ### Example:

    -
     let list:LinkedList<Int> = [1, 2, 3, 4]
    -
    - -
    -
    -

    Declaration

    -
    -

    Swift

    -
    required public convenience init(arrayLiteral elements: Value...)
    - -
    -
    -
    -
    -
  • -
  • -
    - - - - init(_:) - -
    -
    -
    -
    -
    -
    -

    init(elements): A LinkedList can be instantiated with variadic arguments - ### Example:

    -
     let list = LinkedList<Int>(1, 2, 3, 4)
    -
    - -
    -
    -

    Declaration

    -
    -

    Swift

    -
    public convenience init(_ elements: Value...)
    - -
    -
    -
    -
    -
  • -
  • -
    - - - - init(_:) - -
    -
    -
    -
    -
    -
    -

    init(elements): A LinkedList can be instantiated with an array - ### Example:

    -
     let list = LinkedList<Int>([1, 2, 3, 4])
    -
    - -
    -
    -

    Declaration

    -
    -

    Swift

    -
    public convenience init(_ elements: [Value])
    - -
    -
    -
    -
    -
  • @@ -497,7 +410,7 @@

    Declaration

    Declaration

    Swift

    -
    public func makeIterator() -> LinkedList<Value>.LinkedListIterator<LinkedList<Value>.Node<Value>>
    +
    public func makeIterator() -> Iterator
    @@ -1859,7 +1772,7 @@

    Return Value

    diff --git a/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/Classes/LinkedList/Node.html b/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/Classes/LinkedList/Node.html index 7907e37d5..2022f55fd 100644 --- a/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/Classes/LinkedList/Node.html +++ b/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/Classes/LinkedList/Node.html @@ -14,7 +14,7 @@
    -

    DynamicWorkflow Docs (77% documented)

    +

    DynamicWorkflow Docs (74% documented)

    @@ -50,6 +50,9 @@
  • + + + +
  • +
    + + + + ViewPersistance + +
    +
    +
    +
    +
    +
    +

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

    +

    Discussion:

    + +

    Used when you are creating a workflow

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum ViewPersistance
    + +
    +
    +
    +
    +
  • diff --git a/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/Enums/PresentationType.html b/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/Enums/PresentationType.html index 592303b39..631f1edd4 100644 --- a/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/Enums/PresentationType.html +++ b/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/Enums/PresentationType.html @@ -14,7 +14,7 @@
    -

    DynamicWorkflow Docs (77% documented)

    +

    DynamicWorkflow Docs (74% documented)

    @@ -50,6 +50,9 @@ +
    + diff --git a/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/Extensions.html b/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/Extensions.html index 7cafaef19..22df1fcf4 100644 --- a/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/Extensions.html +++ b/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/Extensions.html @@ -14,7 +14,7 @@
    -

    DynamicWorkflow Docs (77% documented)

    +

    DynamicWorkflow Docs (74% documented)

    @@ -50,6 +50,9 @@ + + + + + +
  • - - - launch(view:from:withLaunchStyle:) + + + launch(view:from:withLaunchStyle:animated:completion:) Default implementation @@ -149,7 +152,7 @@

    Default Implementation

    Declaration

    Swift

    -
    func launch(view: ViewType, from root: ViewType, withLaunchStyle launchStyle: PresentationType)
    +
    func launch(view:ViewType, from root:ViewType, withLaunchStyle launchStyle: PresentationType, animated:Bool, completion:@escaping () -> Void)
    @@ -204,7 +207,7 @@

    Parameters

    diff --git a/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/badge.svg b/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/badge.svg index f6985a8a7..70c4b6485 100644 --- a/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/badge.svg +++ b/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/badge.svg @@ -19,10 +19,10 @@ documentation - 77% + 73% - 77% + 73% diff --git a/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/index.html b/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/index.html index fbaed5ed5..fada92437 100644 --- a/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/index.html +++ b/docs/docsets/DynamicWorkflow.docset/Contents/Resources/Documents/index.html @@ -13,7 +13,7 @@
    -

    DynamicWorkflow Docs (77% documented)

    +

    DynamicWorkflow Docs (74% documented)

    @@ -49,6 +49,9 @@
  • + +