NotificationObservation

public final class NotificationObservation : CustomStringConvertible

An opaque reference type that manages the lifetime of a notification observer.

A NotificationObservation is initialized with a dispose block that is executed when the observer is deallocated. Inside the dispose block, you should run whatever actions are needed to remove the observer.

Seealso

NotificationObservationBag
  • Initializes a new observation that runs a provided block when it is deallocated.

    Declaration

    Swift

    public init(_ disposeBlock: @escaping () -> Void)

    Parameters

    disposeBlock

    A block to evaluate when the token is deallocated.

  • Adds the observation to a given observation bag.

    Declaration

    Swift

    public func stored(in bag: NotificationObservationBag)
  • Declaration

    Swift

    public var description: String { get }