1.~/Library/Developer/Xcode/DerivedData/

This folder holds the Xcode cache file, where indexes, build information, etc. of all projects that have ever been run in Xcode are stored. Deletion will be regenerated the next time the project is compiled. Because it contained a lot of information about projects that were no longer useful and I was too lazy to sift through them, I deleted the entire folder.

2.~/Library/Developer/Xcode/iOS DeviceSupport/

Each time a device is connected to the computer for real machine debugging, the computer will index the device and generate the supporting files for the device system under this folder. So there’s a bunch of files that support older iOS devices. I’ve only been doing real debugging on iOS9.3 devices lately. I deleted all folders below 9.3.

3.~/Library/Developer/Xcode/Archives/

DSYM and other data of the App are saved here every time they are packaged, and some useless versions are deleted. If it’s a live version, keep it.

4.~/Library/Developer/Xcode/Products/

Ditto. Delete the useless ones.

5.~/Library/Developer/CoreSimulator/Devices/

A bunch of simulator data. Each folder contains data for a particular system version of the device. You can view the device corresponding to each folder in device.plist. The effect of the delete is the same as that of the reset in the simulator. You don’t have to reset them all. Delete them.

6.~/Library/Developer/XCPGDevices/

This is where the project cache for playground is saved. All deleted.

reference