Swift observation
Asked on 06/16/2025
1 search
Swift observation is a feature that allows developers to track state changes in an object graph automatically. In Swift 6.2, the Observation Library provides general-purpose APIs for this purpose. You can opt a class into observation tracking using the observable
macro. This feature enables you to stream state changes with an async sequence from an observable type, allowing you to react to changes in a transactional manner. Updates are tracked from when any observable properties have their willSet
called until the next await
where the code suspends. This ensures that synchronous updates to multiple properties don't lead to inconsistent states.
For more details, you can refer to the session What’s new in Swift (12:31) which covers the observation library and its capabilities.

What’s new in Swift
Join us for an update on Swift. We’ll talk about workflow improvements that make you more productive, and new and modernized library APIs for fundamental programming tasks. We’ll show examples of Swift adoption throughout more layers of the software stack. Finally, we’ll explore new language features for both improving approachability of concurrency, and achieving peak performance when you need it.

Better together: SwiftUI and RealityKit
Discover how to seamlessly blend SwiftUI and RealityKit in visionOS 26. We’ll explore enhancements to Model3D, including animation and ConfigurationCatalog support, and demonstrate smooth transitions to RealityView. You’ll learn how to leverage SwiftUI animations to drive RealityKit component changes, implement interactive manipulation, use new SwiftUI components for richer interactions, and observe RealityKit changes from your SwiftUI code. We’ll also cover how to use unified coordinate conversion for cross-framework coordinate transformations.

SwiftData: Dive into inheritance and schema migration
Discover how to use class inheritance to model your data. Learn how to optimize queries and seamlessly migrate your app’s data to use inheritance. Explore subclassing for building model graphs, crafting efficient fetches and queries, and implementing robust schema migrations. Understand how to use Observable and persistent history for efficient change tracking.