WorkflowItem

@available(iOS 14.0, macOS 11, tvOS 14.0, watchOS 7.0, *)
public struct WorkflowItem<F, Wrapped, Content> : View where F : FlowRepresentable, F : View, Wrapped : View, Content : View

A concrete type used to modify a FlowRepresentable in a workflow.

Discussion

WorkflowItem gives you the ability to specify changes you’d like to apply to a specific FlowRepresentable when it is time to present it in a Workflow. You create WorkflowItems by calling a thenProceed method, e.g. View.thenProceed(with:), inside of a WorkflowLauncher.

Example

thenProceed(FirstView.self)
           .persistence(.removedAfterProceeding) // affects only FirstView
           .applyModifiers {
               $0.background(Color.gray) // $0 is a FirstView instance
                   .transition(.slide)
                   .animation(.spring())
           }
  • Declaration

    Swift

    public var body: some View { get }
  • Provides a way to apply modifiers to your FlowRepresentable view.

    Important: The most recently defined (or last) use of this, is the only one that applies modifiers, unlike onAbandon or onFinish.

    Declaration

    Swift

    public func applyModifiers<V>(@ViewBuilder _ closure: @escaping (F) -> V) -> WorkflowItem<F, Wrapped, V> where V : View
  • Sets persistence on the FlowRepresentable of the WorkflowItem.

    Declaration

    Swift

    public func persistence(_ persistence: @autoclosure @escaping () -> FlowPersistence.SwiftUI.Persistence) -> WorkflowItem<F, Wrapped, Content>
  • Sets persistence on the FlowRepresentable of the WorkflowItem.

    Declaration

    Swift

    public func persistence(_ persistence: @escaping (F.WorkflowInput) -> FlowPersistence.SwiftUI.Persistence) -> WorkflowItem<F, Wrapped, Content>
  • Sets persistence on the FlowRepresentable of the WorkflowItem.

    Declaration

    Swift

    public func persistence(_ persistence: @escaping (F.WorkflowInput) -> FlowPersistence.SwiftUI.Persistence) -> WorkflowItem<F, Wrapped, Content> where F.WorkflowInput == AnyWorkflow.PassedArgs
  • Sets persistence on the FlowRepresentable of the WorkflowItem.

    Declaration

    Swift

    public func persistence(_ persistence: @escaping () -> FlowPersistence.SwiftUI.Persistence) -> WorkflowItem<F, Wrapped, Content> where F.WorkflowInput == Never
  • Sets the presentationType on the FlowRepresentable of the WorkflowItem.

    Declaration

    Swift

    public func presentationType(_ presentationType: @autoclosure @escaping () -> LaunchStyle.SwiftUI.PresentationType) -> WorkflowItem<F, Wrapped, Content>