AnyStore

public protocol AnyStore : AnyObject

Type Erasure for Store

  • Type Erasure for the Store state

    Declaration

    Swift

    var anyState: State { get }
  • Dispatches a Dispatchable item

    Declaration

    Swift

    @discardableResult
    func dispatch(_ dispatchable: Dispatchable) -> Promise<Void>

    Parameters

    dispatchable

    the dispatchable to dispatch

    Return Value

    a promise that is resolved when the dispatchable is handled by the store

  • Adds a listener to the store. A listener is basically a closure that is invoked every time the Store’s state changes

    Declaration

    Swift

    func addListener(_ listener: @escaping StoreListener) -> StoreUnsubscribe

    Parameters

    listener

    the listener closure

    Return Value

    a closure that can be used to remove the listener