Recommended Xcode settings for Release builds

Over time, I have accumulated the following build settings for my Release builds in Xcode 10 based on some of the older WWDC "Swift compilation/performance" sessions:

SWIFT_OPTIMIZATION_LEVEL = -O
SWIFT_COMPILATION_MODE = wholemodule
OTHER_SWIFT_FLAGS = -whole-module-optimization
LLVM_LTO = YES_THIN

Are these still the recommended way to compile Swift 5 binaries? In particular:

  • Can OTHER_SWIFT_FLAGS = -whole-module-optimization be removed, because it maybe is superseded by SWIFT_COMPILATION_MODE = wholemodule?
  • How much of a performance impact does SWIFT_COMPILATION_MODE = wholemodule have in practice? It seems to slow down "incremental" Release builds, e.g. when making minor changes and then having to recompile to profile their impact.
  • Does LLVM_LTO = YES_THIN have any effect on Swift code? Should I use YES_THIN or YES?

Any guidance would be much appreciated.

1 Like
Terms of Service

Privacy Policy

Cookie Policy