SideEffectContext

public struct SideEffectContext<S, D> where S : State, D : SideEffectDependencyContainer

Context passed to each side effect.

The context is basically a wrapper of methods and utilities that the side effect can leverage to implement its functionalities

  • The dependencies passed to the Store. You can use this as a mechanism for dependencies injection.

    Declaration

    Swift

    public let dependencies: D
  • Function that returns the current configuration of the state

    Declaration

    Swift

    public func getState() -> S

    Return Value

    the current configuration of the state

  • Dispatches a Dispatchable item. This is the equivalent of the Store dispatch.

    See also

    Store implementation of dispatch

    Declaration

    Swift

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