AnyMiddleware

public struct AnyMiddleware<InputActionType, OutputActionType, StateType> : MiddlewareProtocol

Erases the protocol Middleware. Please check its documentation for more information.

  • Undocumented

    Declaration

    Swift

    public init(receiveContext: @escaping (@escaping GetState<StateType>, AnyActionHandler<OutputActionType>) -> Void = { _, _ in },
                handle: @escaping (InputActionType, ActionSource, @escaping GetState<StateType>) -> IO<OutputActionType>)
  • Undocumented

    Declaration

    Swift

    public init<M: MiddlewareProtocol>(_ realMiddleware: M)
    where M.InputActionType == InputActionType, M.OutputActionType == OutputActionType, M.StateType == StateType
  • Declaration

    Swift

    @available(*, deprecated, message: "Instead of relying on receiveContext, please use the getState from handle(action﹚ function,\nand when returning IO from the same handle(action﹚ function use the output from the closure")
    public func receiveContext(getState: @escaping () -> StateType, output: AnyActionHandler<OutputActionType>)
  • Declaration

    Swift

    public func handle(action: InputActionType, from dispatcher: ActionSource, state: @escaping GetState<StateType>) -> IO<OutputActionType>
  • Undocumented

    Declaration

    Swift

    public func lift<GlobalInputActionType, GlobalOutputActionType, GlobalStateType>(
        inputAction inputActionMap: @escaping (GlobalInputActionType) -> InputActionType?,
        outputAction outputActionMap: @escaping (OutputActionType) -> GlobalOutputActionType,
        state stateMap: @escaping (GlobalStateType) -> StateType
    ) -> AnyMiddleware<GlobalInputActionType, GlobalOutputActionType, GlobalStateType>
  • Undocumented

    Declaration

    Swift

    public func lift<GlobalOutputActionType, GlobalStateType>(
        outputAction outputActionMap: @escaping (OutputActionType) -> GlobalOutputActionType,
        state stateMap: @escaping (GlobalStateType) -> StateType
    ) -> AnyMiddleware<InputActionType, GlobalOutputActionType, GlobalStateType>
  • Undocumented

    Declaration

    Swift

    public func lift<GlobalInputActionType, GlobalStateType>(
        inputAction inputActionMap: @escaping (GlobalInputActionType) -> InputActionType?,
        state stateMap: @escaping (GlobalStateType) -> StateType
    ) -> AnyMiddleware<GlobalInputActionType, OutputActionType, GlobalStateType>
  • Undocumented

    Declaration

    Swift

    public func lift<GlobalInputActionType, GlobalOutputActionType>(
        inputAction inputActionMap: @escaping (GlobalInputActionType) -> InputActionType?,
        outputAction outputActionMap: @escaping (OutputActionType) -> GlobalOutputActionType
    ) -> AnyMiddleware<GlobalInputActionType, GlobalOutputActionType, StateType>
  • Undocumented

    Declaration

    Swift

    public func lift<GlobalInputActionType>(
        inputAction inputActionMap: @escaping (GlobalInputActionType) -> InputActionType?
    ) -> AnyMiddleware<GlobalInputActionType, OutputActionType, StateType>
  • Undocumented

    Declaration

    Swift

    public func lift<GlobalOutputActionType>(
        outputAction outputActionMap: @escaping (OutputActionType) -> GlobalOutputActionType
    ) -> AnyMiddleware<InputActionType, GlobalOutputActionType, StateType>
  • Undocumented

    Declaration

    Swift

    public func lift<GlobalStateType>(
        state stateMap: @escaping (GlobalStateType) -> StateType
    ) -> AnyMiddleware<InputActionType, OutputActionType, GlobalStateType>