Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I reset preview data?

I am developing a multi-platform app in XCode 14. My previews read + write data to the Application Support directory for my app, and use @AppStorage properties.

How do I delete all the data for previews? I'd like to reset all the @AppStorage values and file storage, but every article or tutorial seems to be outdated. How do I reset all this data for XCode previews?

I have tried to delete various files and directories based on various tutorials. I have seen some articles and tutorials mention menu items that don't seem to exist in XCode 14.

For instance, I have old files in the "Application Support" directory for my app that are causing issues and I just don't know how to get rid of them.

I would also like to completely erase any @AppStorage values.

Essentially I just want to create a state that mirrors a situation where my app has NEVER run. On my physical iPhone, it's easy enough to just delete the app and reload it from XCode. But the XCode previews are a total mystery to me. I also haven't found a way to reset data for the macOS build.

I just cannot believe it's meant to be so difficult to reset the data. Am I missing something?

like image 889
jnfjnjtj Avatar asked Jun 05 '26 14:06

jnfjnjtj


1 Answers

You can try the following steps:

  • Open terminal.
  • Go to your project directory.
  • Run the following command:

xcrun simctl --set previews delete all

This should clear your preview cache data and it should load fine.

Edit from OP:

Run sudo xcode-select -s /Applications/Xcode.app first.

like image 143
Nirmit Dagly Avatar answered Jun 08 '26 02:06

Nirmit Dagly