MwxCoordinator

public class MwxCoordinator<VM> : AnyCoordinator, ObservableObject where VM : AnyViewModel

You define the coordinator that manages the navigation lifecycle of a view by coordinating its corresponding view model. Implement the required viewModelType property to provide the view model type.

Activators

  • The published activator property which manages the the active state of link and sheet coordinators.

    Note

    Only works with link and sheet coordinators.

    Declaration

    Swift

    @Published
    public var activator: Bool { get set }
  • The published selection property which manages the the selection state of tab coordinators.

    Note

    Only works with tab coordinators.

    Declaration

    Swift

    @Published
    public var selection: Int { get set }

Generic Type

  • The type of view model for this coordinator.

    When you create a coordinator, Swift infers this type from the generic VM type property.

    Declaration

    Swift

    public var viewModelType: VM.Type

Behaviour

  • The presentation use by the coordinator to present the view for the corresponding view model.

    Declaration

    Swift

    public var presentation: MwxPresentation
  • The input used to initialize this view model and passed from presenting view models.

    Declaration

    Swift

    public var input: MwxInput?
  • The callback closure that is invoked when the view for the corresponding view model disappears.

    Declaration

    Swift

    public var onDisappear: (() -> Void)?

Relationship

  • The managing coordinator that presented and is used to manage the current coordinator.

    Declaration

    Swift

    public var managingCoordinator: AnyCoordinator?

View Factory

  • The wrapper factory of the view coordinated by current defined coordinator.

    Declaration

    Swift

    public var wrappedView: some MwxView { get }
  • The view that is of the coordinator manages its navigation lifecycle by coordinating its corresponding view model.

    Declaration

    Swift

    public lazy var view: AnyView { get set }

Initialization

Public Navigation

  • Call this function to show the coordinator by changing its activator state property.

    Note

    Only works with link and sheet coordinators.

    Declaration

    Swift

    public func show()
  • Call this function to show the coordinator by changing its activator state property.

    Note

    Only works with link and sheet coordinators.

    Declaration

    Swift

    public func show(with input: MwxInput?)

    Parameters

    input

    A MwxInput indicates the input data store of the coordinator.

  • Call this function to deactivate the coordinator by changing its activator state property.

    Note

    Only works with link coordinators.

    Declaration

    Swift

    public func pop()
  • Call this function to deactivate the coordinator by changing its activator state property.

    Note

    Only works with sheet coordinators.

    Declaration

    Swift

    public func dismiss()
  • Call this function to select the tab coordinator by changing its selection state property.

    Note

    Works with current tab coordinator or its managing coordinator hierarchy.

    Declaration

    Swift

    public func select(tab selection: Int)

    Parameters

    selection

    A Int indicates the index tag of the selected tab view item.

Internal Navigation

  • Call this function to deactivate the coordinator by changing its activator state property.

    Declaration

    Swift

    public func deactivate()
  • Call this function to select the tab coordinator by changing its selection state property.

    Note

    Only works with the current tab coordinator.

    Declaration

    Swift

    public func setSelection(tab selection: Int)

    Parameters

    selection

    A Int indicates the index tag of the selected tab view item.

Static Initializers

  • Creates an instance of this coordinator.

    Declaration

    Swift

    func with(_ input: MwxInput?) -> MwxCoordinator

    Parameters

    input

    A MwxInput indicates the input data store of the coordinator.

  • Creates an instance of this coordinator.

    Declaration

    Swift

    func onDisappear(_ onDisappear: @escaping () -> Void) -> MwxCoordinator

    Parameters

    onDisappear

    A () -> Void indicates the disappearance callback closure of the coordinator.