CLASS
Reducer
public class Reducer<A: Action>: Disposable
The
Reducerdefines the behavior to be executed when a certainActionobject is received.
Properties
action
public let action: A.Type
The
Actiontype which theReducerlistens to.
dispatcher
public let dispatcher: Dispatcher
The
Dispatcherobject that sends theActionobjects.
reducer
public let reducer: (A) -> Void
The behavior to be executed when the
Dispatchersends a certainAction
Methods
init(of:on:reducer:)
public init(of action: A.Type, on dispatcher: Dispatcher, reducer: @escaping (A) -> Void)
Initializes a new
Reducerobject.
- Parameter action: The
Actiontype that will be listened to.- Parameter dispatcher: The
Dispatcherthat sends theAction.- Parameter reducer: The closure that will be executed when the
Dispatchersends the definedActiontype.
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.