Observation provides the @Observable macro and supporting types that emit change notifications to observers when an object's tracked properties change. Conform a reference type to the Observable protocol, and use ObservationRegistrar to record access to and mutation of its properties. With ObservationTracking and Observations, you respond to changes in the tracked properties an object exposes. The framework is available on iOS, macOS, tvOS, watchOS, and visionOS.
Essentials 1
The protocol that marks a reference type as observable so its tracked properties can emit change notifications.
- PrObservableiOS 17.0+A type that emits notifications to observers when underlying data changes.
Recording Property Access and Mutation 1
The registrar that records access to and mutation of an observable object's tracked properties.
- StObservationRegistrariOS 17.0+Provides storage for tracking and access to data changes.
Tracking and Responding to Changes 2
Types that observe an object's tracked properties and respond when those properties change.
- StObservationTrackingiOS 17.0+A type that tracks reads of an observable object's properties and reports when any tracked property changes.
- StObservationsAn asynchronous sequence generated from a closure that tracks the transactional changes of `@Observable` types.