Contents

NotificationCenter.ObservationToken

A unique token representing a single observer registration in a notification center.

Declaration

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).

See Also

Observing concurrency-safe notifications