CLASS
Reducer
public class Reducer<A: Action>: Disposable
The
Reducer
defines the behavior to be executed when a certainAction
object is received.
Properties
action
public let action: A.Type
The
Action
type which theReducer
listens to.
dispatcher
public let dispatcher: Dispatcher
The
Dispatcher
object that sends theAction
objects.
reducer
public let reducer: (A) -> Void
The behavior to be executed when the
Dispatcher
sends a certainAction
Methods
init(of:on:reducer:)
public init(of action: A.Type, on dispatcher: Dispatcher, reducer: @escaping (A) -> Void)
Initializes a new
Reducer
object.
- Parameter action: The
Action
type that will be listened to.- Parameter dispatcher: The
Dispatcher
that sends theAction
.- Parameter reducer: The closure that will be executed when the
Dispatcher
sends the definedAction
type.
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.