ObserverType
public enum ObserverType
Enum that contains the various events that can be observed
-
Type of closure that is used to check whether a state change should trigger the event
-
Typed version of
StateChangeObserver
Declaration
Swift
public typealias TypedStateChangeObserver<S> = (_ prev: S, _ current: S) -> Bool where S : State
-
Observes a change in the state.
Declaration
Swift
case onStateChange(_: StateChangeObserver, _: [StateObserverDispatchable.Type])
Parameters
observer
a function that should return true when the changes to the state should dispatch items
dispatchable
a list of items to dispatch if the
observer
returns true -
Observes a notification.
Declaration
Swift
case onNotification(_: Notification.Name, _: [NotificationObserverDispatchable.Type])
Parameters
notification
the name of the notification to observe
dispatchable
a list of items to dispatch when the notification is sent
-
Observes a dispatch
Declaration
Swift
case onDispatch(_: Dispatchable.Type, _: [DispatchObserverDispatchable.Type])
Parameters
dispatchable
the type of the dispatchable to observe
dispatchables
a list of items to dispatch when
dispatchable
is dispatched -
Observes when the store starts
Declaration
Swift
case onStart(_: [OnStartObserverDispatchable.Type])
Parameters
dispatchable
a list of items to dispatch when the store starts
-
Helper method that transforms a
TypedStateChangeObserver
into aStateChangeObserver
Declaration
Swift
public static func typedStateChange<S>(_ closure: @escaping TypedStateChangeObserver<S>) -> StateChangeObserver where S : State
Parameters
closure
the closure with type
TypedStateChangeObserver
to transformReturn Value
the closure with type
StateChangeObserver
that is logically equivalent to the given closure