Skip to content

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.

4 min read

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 | head

Reset them

With Xcode quit:

xcrun simctl --set previews delete all

Xcode creates fresh preview devices the next time a preview runs, which takes a little longer the first time.

The other preview costs

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.

Read next