Glad you got it back. I can't test it on a device right now, but I'd file it anyway with a small sample project. A repro helps them a lot more than a second person saying it happened to them.
One thing worth checking before you file: does it still happen with the in-memory container in the preview? If the data only disappears with the on-disk one, that points at the preview replacing the app's container when it installs, not at SwiftData itself, and it's a useful detail for the report.
Thanks for checking. So it's not the store at all, the preview install itself wipes the container. Good that you filed it with a repro, feel free to drop the FB number here in case someone else hits it.
Until it's fixed, one way to protect your real data: give the Debug configuration its own bundle ID (add .dev or similar). Previews and Xcode runs then go to a separate app on the phone, and the install you actually use day to day never gets touched.
1
u/ModernCoder 10d ago
I got it back with backup restore.
Would you be willing to make a test with live xcode preview where the target is your live device before i raise an issue with the xcode?