Show Build Time
You have to enable this settings via command line:
defaults write com.apple.dt.Xcode ShowBuildOperationDuration -bool YES
Whenever Xcode finish building, you will see the time it spent in the top status panel (where you see build “Succeeded”).
With this data displayed, let’s make Xcode build faster.
Whole Module Optimization
The default settings from Xcode makes the build process slow. You may say it is a bug.
Do this for your target’s Debug configuration:
- In Build Settings > Optimization Level > change to Fast, Whole Module Optimization
- In Build Settings > Swift Flags > Add
If you are not sure, screenshots here.
Similarly, you can add a post install hook to
post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| if config.name == 'Debug' config.build_settings['OTHER_SWIFT_FLAGS'] = ['$(inherited)', '-Onone'] config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Owholemodule' end end end end
Build Active Architecture Only
The default from Xcode is correct, but you should double check.
Build Settings > Build Active Architecture > should be Yes for Debug configuration.
What this means is that Xcode will detect the device that is connected and build only for that architecture alone.
If you have followed the recommendations above, you should see significant improvement in your build time.
If not, this wiki on github provides other tricks and good settings.