FunctionalReducer

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

An FunctionalReducer, uses a function to take a given action and a given state and return a new state

  • Undocumented

    Declaration

    Swift

    public typealias ReducerActionType = ActionType
  • Undocumented

    Declaration

    Swift

    public typealias ReducerStateType = StateType
  • Initialise the ActionReducer with a function, converting the current AppState to a new AppState You can provide a reduceFunction for ad hoc use, or overwrite ActionReducer if you want to create a more complex reducer

    Declaration

    Swift

    public init(reduceFunction : @escaping (_ provider: ReducerProvider,
                                            _    action: ActionType,
                                            _     state: StateType) -> StateType)
  • Take a given action, modify a given state and return a new state

    Declaration

    Swift

    public func reduce(provider: ReducerProvider, action: ActionType, state: StateType) -> StateType

    Parameters

    provider

    the reducer container of your application

    action

    a given action

    state

    a given state

    Return Value

    the new state