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

    name

    the unique name for the notification

  • Construct a new notification definition.

    Declaration

    Swift

    public convenience init(name: String)

    Parameters

    name

    the unique name for the notification

  • Post this notification to all observers of it

    Declaration

    Swift

    open func post(value: A)

    Parameters

    value

    the value to forward to the observers

  • Register an observer to receive this notification defintion.

    Declaration

    Swift

    open func registerOnAny(block: @escaping (A) -> Void) -> NotificationObserver

    Parameters

    block

    a 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) -> NotificationObserver

    Parameters

    block

    a closure to execute when this kind of notification arrives

    Return Value

    a NotificationObserver instance that records the registration.