Store

public final class Store<State> : StateStorable
extension Store: ActionDispatcher

Stores and mutates the state of an application.

  • The current state of the store.

    Declaration

    Swift

    public private(set) var state: State { get set }
  • Publishes when the state has changed.

    Declaration

    Swift

    public let didChange: StorePublisher
  • Initiates a new store for the given state and reducer.

    Declaration

    Swift

    public init<R, M>(state: State, reducer: R, middleware: M) where State == R.State, R : Reducer, M : Middleware, R.State == M.State
  • Initiates a new store for the given state and reducer.

    Declaration

    Swift

    public convenience init<R>(state: State, reducer: R) where State == R.State, R : Reducer
  • Sends an action to mutate the state.

    Declaration

    Swift

    @inlinable
    public func send(_ action: Action)

    Parameters

    action

    The action to perform.

  • Sends an action to mutate the state.

    Declaration

    Swift

    @inlinable
    public func sendAsCancellable(_ action: Action) -> Cancellable

    Parameters

    action

    The action to perform.

    Return Value

    A cancellable object.