Skip to content

StructureFoundationEssentials

NotificationCenter.ObservationToken

iOS 26.0+ iPadOS 26.0+ Mac Catalyst 26.0+ macOS 26.0+ tvOS 26.0+ visionOS 26.0+ watchOS 26.0+
A unique token representing a single observer registration in a notification center.
struct ObservationToken

Overview

You receive the ObservationToken type as a return value from addObserver(of:for:using:) and related methods.

Retain the ObservationToken for as long as you need to continue observation, since observation ends when the token goes out of scope. You can also explicitly stop observing by passing the token to removeObserver(_:)-(ObservationToken).

Relationships

Conforms To

  • Swift.Equatable
  • Swift.Hashable
  • Swift.Sendable
  • Swift.SendableMetatype