CLASS

Reducer

public class Reducer<A: Action>: Disposable

The Reducer defines the behavior to be executed when a certain Action object is received.

Properties

action

public let action: A.Type

The Action type which the Reducer listens to.

dispatcher

public let dispatcher: Dispatcher

The Dispatcher object that sends the Action objects.

reducer

public let reducer: (A) -> Void

The behavior to be executed when the Dispatcher sends a certain Action

Methods

init(of:on:reducer:)

public init(of action: A.Type, on dispatcher: Dispatcher, reducer: @escaping (A) -> Void)

Initializes a new Reducer object.

Parameters

Name Description
action The Action type that will be listened to.
dispatcher The Dispatcher that sends the Action.
reducer The closure that will be executed when the Dispatcher sends the defined Action type.

dispose()

public func dispose()

Dispose resource.