StoreProxy

public struct StoreProxy<State> : StateStorable, ActionDispatcher

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.

  • Emits after the specified action was sent to the store.

    Declaration

    Swift

    public var didChange: StorePublisher
  • Retrieves the latest state from the store.

    Declaration

    Swift

    public var state: State { get }
  • Sends an action to mutate the application state.

    Declaration

    Swift

    @inlinable
    public func send(_ action: Action)

    Parameters

    action

    The action to send

  • Sends an action to mutate the application state.

    Declaration

    Swift

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

    Parameters

    action

    The action to send.

    Return Value

    A cancellable object.