Tips to Speed up your Xcode
If your Xcode builds are taking very long time and even switching files takes up a minute of your time then your best option is to cleanup your Mac and get rid of any files or apps that you do not need.
You can use DiskWave software to find out which files and directories are taking up most of your space on Mac. DiskWave
If you have been running Xcode in multiple iOS versions, chances are that you have files related to older unsupported iOS versions. If you no longer need these old versions you can remove these files.
Remove old iOS device support from following path — /Users/username/Library/Developer/Xcode/iOS DeviceSupport
Remove old simulator files from following path — /Users/username/Library/Developer/CoreSimulator/Devices
Note: You may need to enable AppleShowAllFiles settings to view these files. How to show hidden files and folders including ~/Library on a Mac
If all of the above options fail to solve your woes than you can always try formatting your Mac.
You can format your Mac drive and reset the software without any installation disc. How to Wipe Your Mac and Reinstall macOS from Scratch.