Advanced Techniques to Speed Up Compile Time in Xcode
Article Summary
Swiggy's iOS team was watching Xcode compile for minutes after single-line changes. They cut that time by 75%.
Kumar Reddy from Swiggy breaks down the Xcode build system from preprocessor to loader, then shares two phases of optimization: one-time build settings and ongoing dependency management. This isn't theory: it's battle-tested techniques from a production app.
Key Takeaways
- Script execution dropped from 20 seconds to 4 seconds with input/output files
- Complex expression cleanup saved 40 seconds per build cycle
- Incremental builds reduced from 30-120 seconds to 10-70 seconds
- One utility file change compiled 30 files, split files reduced it to 3
- Use Incremental mode for Debug, Whole Module for Release configurations
Swiggy reduced clean build time from 300 to 250 seconds and incremental builds by up to 75% through build settings optimization and restructuring Swift dependency graphs.
About This Article
iOS developers were stuck with slow incremental builds. Swift recompiles all dependent files whenever you add a new function, struct, or extension to a single file. This creates a cascading effect across the codebase.
Kumar Reddy's team split their monolithic utility and extension files into separate files, each focused on one extension type. This let the Swift dependency graph compile only the affected files instead of the entire dependent chain.
After restructuring, changing a single line in a utility file now compiles 3 files instead of 30. Better code organization cuts incremental build times without needing compiler flag changes.