ComposedMiddleware
public struct ComposedMiddleware<InputActionType, OutputActionType, StateType> : MiddlewareProtocol
extension ComposedMiddleware: Monoid
                The ComposedMiddleware is a container of inner middlewares that are chained together in the order as they were composed. Whenever an EventProtocol or an ActionProtocol arrives to be handled by this ComposedMiddleware, it will delegate to its internal chain of middlewares.
It could be initialized manually by using the init() and configured by using the method append(middleware:), but if you’re ok with using custom operators you can compose two or more middlewares using the diamond operator:
let composedMiddleware = firstMiddleware <> secondMiddleware <> thirdMiddleware
          - 
                  
                  
Default initializer for
ComposedMiddleware, use this only if you don’t like custom operators, otherwise create aComposedMiddlewareby composing two or more middlewares using the diamond operator, as shown below:let composedMiddleware = firstMiddleware <> secondMiddlewareDeclaration
Swift
public init() - 
                  
                  
Appends a new middleware to end of the composition (inner chain). Use this only if you don’t like custom operators, otherwise create a
ComposedMiddlewareappend more middlewares to the composition by using the diamond operator, as shown below:let composedOfThreeMiddlewares = composedOfTwoMiddlewares <> thirdMiddlewareOr
let composedOfThreeMiddlewares = firstMiddleware <> secondMiddleware <> thirdMiddlewareDeclaration
Swift
public mutating func append<M: MiddlewareProtocol>(middleware: 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>) - 
                  
                  
Handles the incoming actions. The
ComposedMiddlewarewill forward each action to all its internal middlewares, in the order as they were composed together, and when all of them are done, theActionTypewill be forwarded to the next middleware in the chain, or to the reducer pipeline in case this is the last middleware.The internal middlewares in this
ComposedMiddlewarecontainer may trigger additional actions, as any middleware, and in this case the actions will be forwarded to the store by using thecontextproperty or the parent composed middleware object.Declaration
Swift
public func handle(action: InputActionType, from dispatcher: ActionSource, state: @escaping GetState<StateType>) -> IO<OutputActionType>Parameters
actionthe action to be handled
dispatcherinformation about the file, line and function that dispatched this action
statea closure to obtain the most recent state
Return Value
possible Side-Effects wrapped in an IO struct
 - 
                  
                  
Undocumented
Declaration
Swift
public func lift<GlobalInputActionType, GlobalOutputActionType, GlobalStateType>( inputAction inputActionMap: @escaping (GlobalInputActionType) -> InputActionType?, outputAction outputActionMap: @escaping (OutputActionType) -> GlobalOutputActionType, state stateMap: @escaping (GlobalStateType) -> StateType ) -> ComposedMiddleware<GlobalInputActionType, GlobalOutputActionType, GlobalStateType> - 
                  
                  
Undocumented
Declaration
Swift
public func lift<GlobalOutputActionType, GlobalStateType>( outputAction outputActionMap: @escaping (OutputActionType) -> GlobalOutputActionType, state stateMap: @escaping (GlobalStateType) -> StateType ) -> ComposedMiddleware<InputActionType, GlobalOutputActionType, GlobalStateType> - 
                  
                  
Undocumented
Declaration
Swift
public func lift<GlobalInputActionType, GlobalStateType>( inputAction inputActionMap: @escaping (GlobalInputActionType) -> InputActionType?, state stateMap: @escaping (GlobalStateType) -> StateType ) -> ComposedMiddleware<GlobalInputActionType, OutputActionType, GlobalStateType> - 
                  
                  
Undocumented
Declaration
Swift
public func lift<GlobalInputActionType, GlobalOutputActionType>( inputAction inputActionMap: @escaping (GlobalInputActionType) -> InputActionType?, outputAction outputActionMap: @escaping (OutputActionType) -> GlobalOutputActionType ) -> ComposedMiddleware<GlobalInputActionType, GlobalOutputActionType, StateType> - 
                  
                  
Undocumented
Declaration
Swift
public func lift<GlobalInputActionType>( inputAction inputActionMap: @escaping (GlobalInputActionType) -> InputActionType? ) -> ComposedMiddleware<GlobalInputActionType, OutputActionType, StateType> - 
                  
                  
Undocumented
Declaration
Swift
public func lift<GlobalOutputActionType>( outputAction outputActionMap: @escaping (OutputActionType) -> GlobalOutputActionType ) -> ComposedMiddleware<InputActionType, GlobalOutputActionType, StateType> - 
                  
                  
Undocumented
Declaration
Swift
public func lift<GlobalStateType>( state stateMap: @escaping (GlobalStateType) -> StateType ) -> ComposedMiddleware<InputActionType, OutputActionType, GlobalStateType> - 
                  
                  
Composed middleware identity is an empty composed middleware collection
Declaration
Swift
public static var identity: ComposedMiddleware<InputActionType, OutputActionType, StateType> { get } 
View on GitHub
        ComposedMiddleware Structure Reference