Speed up Xcode Swift build times

后端 未结 5 677
难免孤独
难免孤独 2021-02-04 17:30

As my project has grown over the past year, so have its build times. Over the last few months it\'s gone from 4 minutes to around 7 (time includes GitHub pull, unit tests, etc).

5条回答
  •  天涯浪人
    2021-02-04 17:56

    Since Xcode 9.3 there is a Compilation Mode called Single File. It's explicitly said that it can change a game when talking about compilation times in the Xcode release notes

    The choice for compiling Swift code by file or by module moved from the Optimization Level setting to Compilation Mode, which is a new setting for the Swift compiler in the Build Settings pane of the Project editor. Previously this choice was combined with others in the Optimization Level setting. Compiling by file enables building only the files that changed, enabling faster builds. Compiling by module enables better optimization.

    It truly is a life saver. My incremental compilation times for enterprise project was decreased to couple of seconds. You can try it.

    EDIT: In Xcode 12, the same can be referred as Incremental

提交回复
热议问题