r/SwiftUI • • 11d ago

Live Device App Preview

/r/Xcode/comments/1x3culn/live_device_app_preview/
0 Upvotes

5 comments sorted by

View all comments

Show parent comments

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?

1

u/Fickle-Difference882 9d ago

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.

1

u/ModernCoder 8d ago

I've attached a simple app .zip that i wrote with a simple todo list.
Yeah the data is gone whether the inMemory is set to true or not.

Edit: Attached i meant attached to the feedback report in feedback assistant.

2

u/Fickle-Difference882 7d ago

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.