Middleware
public struct Middleware<State>
Middleware is a structure that allows you to modify, filter out and dispatch more actions, before the action being handled reaches the store.
-
Create a blank slate Middleware.
Declaration
Swift
public init() -
Initialises the middleware by concatenating the transformative functions from the middleware that was passed in.
Declaration
Swift
public init(_ first: Middleware<State>, _ rest: Middleware<State>...) -
Safe encapsulation of side effects guaranteed not to affect the action being passed through the middleware.
Declaration
Swift
public func sideEffect(_ effect: @escaping (GetState, @escaping DispatchFunction, Action) -> Void) -> Middleware<State> -
Concatenates the transform function of the passed
Middlewareonto the callee’s transform.Declaration
Swift
public func concat(_ other: Middleware<State>) -> Middleware<State> -
Transform the action into another action.
Declaration
-
Undocumented
Declaration
Swift
public struct Middleware<State> -
One to many pattern allowing one action to be turned into multiple.
Declaration
-
Filters while mapping actions to new actions.
Declaration
-
Drop the action iff
isIncluded(action) != true.Declaration
Swift
public func filter(_ isIncluded: @escaping (GetState, Action) -> Bool) -> Middleware<State>
View on GitHub
Install in Dash
Middleware Struct Reference