Show Build Time

You have to enable this settings via command line:

defaults write 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:

  1. In Build Settings > Optimization Level > change to Fast, Whole Module Optimization
  2. In Build Settings > Swift Flags > Add -Onone

If you are not sure, screenshots here.

UPDATE 2023:

Xcode has changed. This is how you should configure your building settings:

  • Compilation Mode
    • Debug: Incremental
    • Release: Whole Module
  • Optimization Level
    • Debug: -Onone (none)
    • Release: -O (speed)

Pods too

Similarly, you can add a post install hook to Podfile.

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if == 'Debug'
        config.build_settings['OTHER_SWIFT_FLAGS'] = ['$(inherited)', '-Onone']
        config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Owholemodule'

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.

Other Tricks

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.




Back to Home