Observable
Generated on 8/4/2024
1 search
Observable objects and data-race safety are key topics discussed in the context of Swift 6 and SwiftUI. Here are some relevant points from the sessions:
-
Migrate your app to Swift 6:
- The session discusses how to handle observable objects in SwiftUI, particularly when dealing with concurrency and actors. For example, if you have a SwiftUI observable object and a save operation on another actor, you need to ensure that the data being shared between these actors is sendable to avoid data races. This is crucial when the main actor and another actor could access shared mutable state simultaneously (Migrate your app to Swift 6).
- The session also covers how to handle global variables and instances to ensure they are safe from data races by using actors or marking them as sendable (Migrate your app to Swift 6).
-
A Swift Tour: Explore Swift’s features and design:
- This session explains the importance of avoiding data races and how Swift 6 ensures data-race safety at compile time. It introduces the concept of sendable values, which protect their state from concurrent accesses, and discusses how actors can be used to encapsulate shared mutable state safely (A Swift Tour: Explore Swift’s features and design).
-
Track model changes with SwiftData history:
- This session highlights how SwiftData history can be used to track changes in your data store over time, which is useful for maintaining data consistency across different parts of your app, such as when dealing with observable objects (Track model changes with SwiftData history).
Relevant Sessions
- Migrate your app to Swift 6
- A Swift Tour: Explore Swift’s features and design
- Track model changes with SwiftData history
These sessions provide a comprehensive overview of handling observable objects, ensuring data-race safety, and tracking model changes in Swift 6.
Meet FinanceKit
Learn how FinanceKit lets your financial management apps seamlessly and securely share on-device data from Apple Cash, Apple Card, and more, with user consent and control. Find out how to request one-time and ongoing access to accounts, transactions, and balances — and how to build great experiences for iOS and iPadOS.
Migrate your app to Swift 6
Experience Swift 6 migration in action as we update an existing sample app. Learn how to migrate incrementally, module by module, and how the compiler helps you identify code that’s at risk of data races. Discover different techniques for ensuring clear isolation boundaries and eliminating concurrent access to shared mutable state.
A Swift Tour: Explore Swift’s features and design
Learn the essential features and design philosophy of the Swift programming language. We’ll explore how to model data, handle errors, use protocols, write concurrent code, and more while building up a Swift package that has a library, an HTTP server, and a command line client. Whether you’re just beginning your Swift journey or have been with us from the start, this talk will help you get the most out of the language.
Track model changes with SwiftData history
Reveal the history of your model’s changes with SwiftData! Use the history API to understand when data store changes occurred, and learn how to use this information to build features like remote server sync and out-of-process change handing in your app. We’ll also cover how you can build support for the history API into a custom data store.