core data with swiftui
Asked on 05/21/2025
1 search
To work with Core Data in SwiftUI, Apple introduced SwiftData, a framework that simplifies building your app's model layer and persisting data across app launches. SwiftData integrates seamlessly with SwiftUI, allowing you to define your data models using a model macro and manage them with a model container modifier. This setup enables your SwiftUI views to query and display data efficiently.
For more details on how to adopt SwiftData in your SwiftUI app, you can refer to the session What’s new in SwiftData (00:01:01). This session covers the basics of adopting SwiftData, customizing schemas, and optimizing queries for better performance.
Additionally, the session SwiftUI essentials (20:30) discusses the interoperability of SwiftUI with other frameworks, including how SwiftData can be used to add persistent models to your app quickly.

What’s new in SwiftData
SwiftData makes it easy to add persistence to your app with its expressive, declarative API. Learn about refinements to SwiftData, including compound uniqueness constraints, faster queries with #Index, queries in Xcode previews, and rich predicate expressions. Join us to explore how you can use all of these features to express richer models and improve performance in your app. To discover how to build a custom data store or use the history API in SwiftData, watch “Create a custom data store with SwiftData” and “Track model changes with SwiftData history”.

Get started with HealthKit in visionOS
Discover how to use HealthKit to create experiences that take full advantage of the spatial canvas. Learn the capabilities of HealthKit on the platform, find out how to bring an existing iPadOS app to visionOS, and explore the special considerations governing HealthKit during a Guest User session. You’ll also learn ways to use SwiftUI, Swift Charts, and Swift concurrency to craft innovative experiences with HealthKit.

Platforms State of the Union
Discover the newest advancements on Apple platforms.