EffectRunner

public struct EffectRunner<Environment>

The EffectRunner can be used to run Effects with a specified Action.

  • Run the Effect with the specified Action and return the published Actions.

    The expectedCount defines how many Actions the Publisher should publish before they are returned. If the Effect is .nonDispatching, the expectedCount is ignored.

    Declaration

    Swift

    @discardableResult
    public static func run(_ effect: Effect<Environment>,
                           with action: Action,
                           environment: Environment,
                           expectedCount: Int = 1) throws -> [Action]?

    Parameters

    effect

    The Effect to run

    action

    The Action to send to the Effect

    environment

    The Environment to send to the Effect

    expectedCount

    The count of Actions to wait for

    Return Value

    The Actions published by the Effect if it is dispatching

Available where Environment == Void

  • Run the Effect with the specified Action and return the published Actions.

    The expectedCount defines how many Actions the Publisher should publish before they are returned. If the Effect is .nonDispatching, the expectedCount is ignored.

    Declaration

    Swift

    @discardableResult
    static func run(_ effect: Effect<Environment>,
                    with action: Action,
                    expectedCount: Int = 1) throws -> [Action]?

    Parameters

    effect

    The Effect to run

    action

    The Action to send to the Effect

    expectedCount

    The count of Actions to wait for

    Return Value

    The Actions published by the Effect if it is dispatching