WorkflowItem
@available(iOS 14.0, macOS 11, tvOS 14.0, watchOS 7.0, *)
public struct WorkflowItem<FlowRepresentableType, Content> : _WorkflowItemProtocol where FlowRepresentableType : FlowRepresentable, FlowRepresentableType : 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. WorkflowItems are most often created inside a WorkflowView or WorkflowGroup.
Example
WorkflowItem(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 } -
Declaration
Swift
public func canDisplay(_ element: AnyWorkflow.Element?) -> Bool -
Declaration
Swift
public func didDisplay(_ element: AnyWorkflow.Element?) -> Bool -
Declaration
Swift
public mutating func setElementRef(_ element: AnyWorkflow.Element?) -
Creates a workflow item from a FlowRepresentable type
Declaration
Swift
public init(_ item: FlowRepresentableType.Type) where FlowRepresentableType == Content -
Creates a
WorkflowItemfrom aUIViewController.Declaration
Swift
@available(iOS 14.0, macOS 11, tvOS 14.0, *) public init<VC>(_: VC.Type) where FlowRepresentableType == ViewControllerWrapper<VC>, Content == ViewControllerWrapper<VC>, VC : UIViewController, VC : FlowRepresentable -
Provides a way to apply modifiers to your
FlowRepresentableview.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 (FlowRepresentableType) -> V) -> WorkflowItem<FlowRepresentableType, V> where V : View -
Sets persistence on the
FlowRepresentableof theWorkflowItem.Declaration
Swift
public func persistence(_ persistence: @autoclosure @escaping () -> FlowPersistence.SwiftUI.Persistence) -> WorkflowItem<FlowRepresentableType, Content> -
Sets persistence on the
FlowRepresentableof theWorkflowItem.Declaration
Swift
public func persistence(_ persistence: @escaping (FlowRepresentableType.WorkflowInput) -> FlowPersistence.SwiftUI.Persistence) -> WorkflowItem<FlowRepresentableType, Content> -
Sets persistence on the
FlowRepresentableof theWorkflowItem.Declaration
Swift
public func persistence(_ persistence: @escaping (FlowRepresentableType.WorkflowInput) -> FlowPersistence.SwiftUI.Persistence) -> WorkflowItem<FlowRepresentableType, Content> where FlowRepresentableType.WorkflowInput == AnyWorkflow.PassedArgs -
Sets persistence on the
FlowRepresentableof theWorkflowItem.Declaration
Swift
public func persistence(_ persistence: @escaping () -> FlowPersistence.SwiftUI.Persistence) -> WorkflowItem<FlowRepresentableType, Content> where FlowRepresentableType.WorkflowInput == Never -
Sets the presentationType on the
FlowRepresentableof theWorkflowItem.Declaration
Swift
public func presentationType(_ presentationType: @autoclosure @escaping () -> LaunchStyle.SwiftUI.PresentationType) -> WorkflowItem<FlowRepresentableType, Content>
View on GitHub
WorkflowItem Structure Reference