SwiftUI Previews run in their own simulators, and those simulators keep their own data
Xcode Previews use a separate set of simulator devices with their own caches. Where they are, how big they get, and the one command that resets them.
Every time a SwiftUI preview renders, Xcode runs it in a simulator. Previews use their own set of simulator devices, separate from the ones in the Simulator app, and each builds up its own app data and caches. Clearing normal simulators does not touch them.
du -sh ~/Library/Developer/Xcode/UserData/Previews 2>/dev/null
xcrun simctl --set previews list devices | headReset them
With Xcode quit:
xcrun simctl --set previews delete allXcode creates fresh preview devices the next time a preview runs, which takes a little longer the first time.
The other preview costs
- Preview builds also land in DerivedData. See DerivedData cleanup.
- Simulator runtimes, the OS images both previews and simulators need, are covered in iOS simulators.
Common questions
Where does Xcode store SwiftUI preview data?
In a separate simulator device set, under ~/Library/Developer/Xcode/UserData/Previews. xcrun simctl --set previews lists them.
How do I clear Xcode Previews?
Quit Xcode and run xcrun simctl --set previews delete all. Xcode recreates preview devices when needed.
Does deleting simulators also delete preview devices?
No. Previews use their own device set, which has to be cleared separately.