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
StateChangeObserverDeclaration
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
observera function that should return true when the changes to the state should dispatch items
dispatchablea list of items to dispatch if the
observerreturns true -
Observes a notification.
Declaration
Swift
case onNotification(_: Notification.Name, _: [NotificationObserverDispatchable.Type])Parameters
notificationthe name of the notification to observe
dispatchablea list of items to dispatch when the notification is sent
-
Observes a dispatch
Declaration
Swift
case onDispatch(_: Dispatchable.Type, _: [DispatchObserverDispatchable.Type])Parameters
dispatchablethe type of the dispatchable to observe
dispatchablesa list of items to dispatch when
dispatchableis dispatched -
Observes when the store starts
Declaration
Swift
case onStart(_: [OnStartObserverDispatchable.Type])Parameters
dispatchablea list of items to dispatch when the store starts
-
Helper method that transforms a
TypedStateChangeObserverinto aStateChangeObserverDeclaration
Swift
public static func typedStateChange<S>(_ closure: @escaping TypedStateChangeObserver<S>) -> StateChangeObserver where S : StateParameters
closurethe closure with type
TypedStateChangeObserverto transformReturn Value
the closure with type
StateChangeObserverthat is logically equivalent to the given closure
View on GitHub
ObserverType Enumeration Reference