Functions

The following functions are available globally.

  • Undocumented

    Declaration

    Swift

    public func <> <OutputActionType>(lhs: IO<OutputActionType>, rhs: IO<OutputActionType>) -> IO<OutputActionType>
  • The combination between two AfterReducer instances occur in reverse order so the first middleware will have its “after reducer” closure executed last. This composition can be achieved by using the operator <>.

    Declaration

    Swift

    @available(*, deprecated, message: "Use `MiddlewareProtocol` instead of `Middleware`. It doesn't use `AfterReducer`. This operator will be removed on 1.0.")
    public func <> (lhs: AfterReducer, rhs: AfterReducer) -> AfterReducer
  • Initializes a ComposedMiddleware from the lhs and rhs middlewares parameters, or appends to the lhs if it is already a ComposedMiddleware, as shown below:

    let composedOfThreeMiddlewares = composedOfTwoMiddlewares <> thirdMiddleware
    

    Or

    let composedOfThreeMiddlewares = firstMiddleware <> secondMiddleware <> thirdMiddleware
    

    Or

    let composedMiddlewares = firstMiddleware <> secondMiddleware
    _ = composedMiddlewares <> thirdMiddleware
    // assert(composedMiddlewares == firstMiddleware <> secondMiddleware <> thirdMiddleware)
    

    Declaration

    Swift

    public func <> <M1: MiddlewareProtocol, M2: MiddlewareProtocol>(lhs: M1, rhs: M2)
    -> ComposedMiddleware<M1.InputActionType, M1.OutputActionType, M1.StateType>
    where M1.InputActionType == M2.InputActionType,
          M1.OutputActionType == M2.OutputActionType,
          M1.StateType == M2.StateType

    Parameters

    lhs

    A flat middleware or a composed middleware, in case it’s a flat one, this operation will create a new ComposedMiddleware and return it, otherwise it will append the rhs to this composed lhs one mutating it and also returning it.

    rhs

    A flat middleware to be appended to the end of a ComposedMiddleware

    Return Value

    A ComposedMiddleware that calls the lhs methods before the rhs ones. If lhs is already a ComposedMiddleware, we will return the same instance after mutating it to have the rhs in the end of its chain.