Observer

Asked on 06/16/2025

1 search

The concept of "Observer" is discussed in several sessions at WWDC 2025, particularly in the context of Swift and SwiftUI. Here are some highlights:

  1. Swift Observation Library: In the session What’s new in Swift, the Observation Library is introduced, which provides general-purpose APIs for automatically tracking state changes in an object graph. This is based on a more general observer pattern, allowing you to opt a class into observation tracking using the observable macro.

  2. SwiftUI and RealityKit: In the session Better together: SwiftUI and RealityKit, entities in Vision OS 26 are now observable, allowing them to notify other code when their properties change. This session discusses how to observe properties directly using SwiftUI's built-in observation tracking.

  3. UIKit Automatic Observation Tracking: The session What’s new in UIKit covers automatic observation tracking in UIKit, which simplifies keeping UI components in sync with model changes without extra code.

  4. HealthKit Medications API: In the session Meet the HealthKit Medications API, anchored object queries are discussed as a more efficient alternative to paired observer queries and sample queries for keeping app data up to date.

These sessions highlight the integration of observer patterns and observation tracking across different Apple frameworks, enhancing the ability to react to state changes efficiently.

Observer | Ask WWDC