SwiftData does not support public database but you can create CKContainer and CKRecord to manually persist items in the public db.
SwiftData does not support public database but you can create CKContainer and CKRecord to manually persist items in the public db.
SwiftData is Apple's modern framework for data persistence, introduced in iOS 17. It provides a Swift-native way to model and persist data using macros and property wrappers, making it easier than ever to work with persistent data in your apps. What is SwiftData? SwiftData is a declarative framework for data modeling and management that leverages Swift macros. It replaces Core Data's complex setup with a more intu...

Fun With SwiftData and CloudKit!: https://pmcconnell.micro.blog/2026/04/30/fun-with-swiftdata-and-cloudkit.html
If you have a #SwiftUI List/Grid and you are iterating over Model objects using id: \.self you may encounter a duplicate key in dictionary error resulting in a crash.
Changing to id: \.id or removing the id parameter entirely should resolve this issue.
for example:
forEach(photo, id: \.self) *boom*
forEach(photo) or forEach(photo, id: \.id) all good
Tricky to debug from the error message/trace but easy fix.
Optimize your view because we're going to machine gun update it is never the right answer. None of the data is changing. Zero updates are warranted.
#Xcode just logs some computed property changed and redraws. In a sample app I provided Apple (naively, I know) This happens with a list of models that contain nothing more than a timestamp. No computed properties.
This is a framework problem, not something I can optimize away.
6 months later I'm still stuck on a issue where #SwiftData queries refresh the view excessively.
I’ve seen very few references to anything similar in online and any time an Apple engineer replies they suggest limiting the fetched objects.
That's not always possible, nor is it a “solution.” In my app I'm rendering complex paths on a map view and the coordinates that make up the path can't be limited.
Excessive, unnecessary redraws are visible and a UX problem.
SwiftData Doesn’t Work Like You Think in UIKit
https://youtu.be/Qcl2HmzFgbA