AnyAsyncActionReducer
public struct AnyAsyncActionReducer
A substitution wrapper for an instance of ActionReducerType
-
Create an AnyActionReducer with an instance of type ActionReducerType
Declaration
Swift
public init<R>(_ reducer: R) where R : AsyncActionReducerType
-
Create an AnyActionReducer with an instance of an ActionReducer
Declaration
Swift
public init<StateType, ActionType>(_ reducer: AsyncActionReducer<StateType, ActionType>) where ActionType : Action
-
Check if this reducer is responsible for a given action and state
Note
The default implementation simply checks if the given action and state conform to the reducers action and state typesDeclaration
Swift
public func isResponsible(action: Action, state: Any) -> Bool
Parameters
action
a given action
state
a given state
Return Value
returns if the reducer is responsible for this action/state pair
-
Take a given action, modify a given state and return a new state
Declaration
Swift
public func reduce<StateType>(provider: ReducerProvider, action: Action, completion: @escaping (_ newState: StateType) -> Void)
Parameters
action
a given action
state
a given state
Return Value
the new state