AnyScreenAction

public struct AnyScreenAction<Container: ScreenContainer, Output>:
    ScreenAction,
    CustomStringConvertible

An action that performs type erasure by wrapping another action.

AnyScreenAction is a concrete implementation of ScreenAction that has no significant properties of its own, and passes through elements from its wrapped action.

Use AnyScreenAction to wrap an actions whose type has details you don’t want to expose across API boundaries, such as different modules. When you use type erasure this way, you can change the underlying acrtion implementation over time without affecting existing clients.

You can use eraseToAnyAction() and eraseToAnyVoidAction()methods to wrap an action with AnyScreenAction.

See also

ScreenAction
  • Declaration

    Swift

    public typealias Output = Output
  • Declaration

    Swift

    public var description: String { get }
  • Creates a type-erasing action to wrap the provided action.

    Declaration

    Swift

    public init<Wrapped: ScreenAction>(
        _ wrapped: Wrapped
    ) where Wrapped.Container == Container, Wrapped.Output == Output

    Parameters

    wrapped

    An action to wrap with a type-eraser.

  • Declaration

    Swift

    public func cast<Action>(to type: Action.Type) -> Action? where Action : ScreenAction
  • Declaration

    Swift

    public func combine<Action: ScreenAction>(
        with other: Action
    ) -> AnyScreenAction<Container, Void>?
  • Declaration

    Swift

    public func perform(
        container: Container,
        navigator: ScreenNavigator,
        completion: @escaping Completion
    )

Available where Output == Void

  • Undocumented

    Declaration

    Swift

    public init<Wrapped: ScreenAction>(
        _ wrapped: Wrapped
    ) where Wrapped.Container == Container