Xcode caches and SwiftUI Previews data: safe to delete?
Quit first: Xcode · Simulator
Where it is
~/Library/Caches/com.apple.dt.Xcode~/Library/Developer/Xcode/UserData/Previews~/Library/Developer/CoreSimulator/Caches~/Library/Developer/Xcode/Products
What it is
Besides DerivedData, Xcode keeps a general cache in ~/Library/Caches, SwiftUI Previews builds and preview devices under UserData/Previews, CoreSimulator caches for simulator runtimes, and a Products folder of build outputs.
Why it gets so big
SwiftUI Previews run in their own simulator devices with their own builds of your app, which grow with every project you preview. Simulator caches are built per runtime, so each new runtime you install adds more.
Is it safe to delete?
Yes. All of it is regenerated: Previews rebuild the next time you use them, simulators recreate their caches when they boot (so the first boot is slower), and Xcode refills its own cache. Quit Xcode and Simulator first so nothing is in use.
Tip
Simulator runtimes themselves are managed separately, from the Platforms or Components pane in Xcode's settings depending on your Xcode version.
See how much space it uses
du -sh "$HOME/Library/Caches/com.apple.dt.Xcode" "$HOME/Library/Developer/Xcode/UserData/Previews" "$HOME/Library/Developer/CoreSimulator/Caches" "$HOME/Library/Developer/Xcode/Products" 2>/dev/nullDelete it by hand
Run in Terminal. Deleting cannot be undone, so check the paths first.
rm -rf "$HOME/Library/Caches/com.apple.dt.Xcode"/*
rm -rf "$HOME/Library/Developer/Xcode/UserData/Previews"/*
rm -rf "$HOME/Library/Developer/CoreSimulator/Caches"/*
rm -rf "$HOME/Library/Developer/Xcode/Products"/*