ActionReducer

public struct ActionReducer<StateType, ActionType> : ActionReducerType where ActionType : Action

An struct wrapping a implementation of ActionReducerType

  • Undocumented

    Declaration

    Swift

    public typealias ReducerActionType = ActionType
  • Undocumented

    Declaration

    Swift

    public typealias ReducerStateType = StateType
  • Undocumented

    Declaration

    Swift

    public init<A>(_ reducer: A) where StateType == A.ReducerStateType, ActionType == A.ReducerActionType, A : ActionReducerType
  • 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 types

    Declaration

    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(provider: ReducerProvider, action: ReducerActionType, state: ReducerStateType) -> ReducerStateType

    Parameters

    action

    a given action

    state

    a given state

    Return Value

    the new state