TypedNotification
open class TypedNotification<A>
Typed notification definition. Template argument defines the type of a value that will be transmitted in the notification userInfo[“value”] slot. This value will be available to blocks registered to receive it
-
The name of the notification
Declaration
Swift
public let name: Notification.Name -
Construct a new notification definition.
Declaration
Swift
public required init(name: Notification.Name)Parameters
namethe unique name for the notification
-
Construct a new notification definition.
Declaration
Swift
public convenience init(name: String)Parameters
namethe unique name for the notification
-
Post this notification to all observers of it
Declaration
Swift
open func post(value: A)Parameters
valuethe value to forward to the observers
-
Register an observer to receive this notification defintion.
Declaration
Swift
open func registerOnAny(block: @escaping (A) -> Void) -> NotificationObserverParameters
blocka closure to execute when this kind of notification arrives
Return Value
a NotificationObserver instance that records the registration.
-
Register for a notification that only takes place on the app’s main (UI) thread.
Declaration
Swift
open func registerOnMain(block: @escaping (A) -> Void) -> NotificationObserverParameters
blocka closure to execute when this kind of notification arrives
Return Value
a NotificationObserver instance that records the registration.
View on GitHub
TypedNotification Class Reference