Your Life With (and Without) Observation
summary
Observation replaces ObservableObject for SwiftUI state, ships in Swift 5.9 as part of the stdlib and requires iOS 17+, uses opt-out by default macros that compile into getters/setters calling a per-instance registar and a thread-local access list to record accessed keypaths, then installs observations to call onChange only for actual property changes. It supports nested optionals and collections, forbids lazy/custom property wrappers and no value types, and Xcode 15 can expand the macros so the generated code is debuggable.
AI-written summary · about
chapters (14)
- 0:00Introduction to observation
- 1:22Limitations of ObservableObject
- 3:28Observable vs ObservableObject
- 5:12Under the hood of Observation
- 8:06Registrars and access lists
- 11:06Observation tracking
- 13:44Tracking implementation
- 17:31Summary of tracking workflow
- 18:50Migration and pitfalls
- 21:57State vs. Identity
- 24:06Real world animation examples
- 27:13Escaping content closures
- 31:11Limitations and takeaways
- 33:13Q&A and conclusion
related talks
36mData flow in SwiftUI - from @State to @Observable...
47mExploring Key Practices of Observation and SwiftData in New Application Development
35mSpeeding Up SwiftUI with Observable
49mWhy SwiftUI?
37mGlobal Variable Oriented Programming
42mThe Evolution of Presentation Patterns in SwiftUI
26mSwiftUI for Production
34mBuilding (and testing) custom property wrappers in SwiftUI
