Store

  • The primary container of an application’s state.

    The store both contains and mutates the state through a provided reducer as it’s sent actions. Use the didChange publisher to be notified of changes.

    See more

    Declaration

    Swift

    public final class Store<State>
    extension Store: ActionDispatcher
  • Performs an action on a given state and returns a whole new version.

    A store is given a single root Reducer. As it’s sent actions, it runs the reducer to update the application’s state. The reducer can have subreducers to separate code out into modular parts.

    For a reducer’s own state and actions, implement the reduce(state:action:). For subreducers, implement the reduceNext(state:action:) method.

    See more

    Declaration

    Swift

    public protocol Reducer
  • Creates a proxy of the store object for use by middleware.

    Middleware may use the store proxy to retreive the current state, send actions, continue to the next middleware, or subscribe to store changes. With the proxy, middleware don’t have to worry about retaining the store. Instead, the proxy provides a safe API to access a weak reference to it.

    See more

    Declaration

    Swift

    public struct StoreProxy<State> : ActionDispatcher
  • Combines two reducers together. Use the + operator to create a combned reducer.

    See more

    Declaration

    Swift

    public final class CombinedReducer<State, A, B> : Reducer where State == A.State, A : Reducer, B : Reducer, A.State == B.State
  • Actions performed for the store itself.

    See more

    Declaration

    Swift

    public enum StoreAction<State> : Action