Xcode 8 very slow Swift compiling

后端 未结 8 1496
太阳男子
太阳男子 2020-12-12 13:54

Ever since Swift 3 and Xcode 8 my project compiles quite slowly. Every time I add so much as an empty line to a file, recompiling takes a full minute. When I check the outpu

8条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-12 14:36

    A issue with this problem is that we don't know where is the wrong initialization/declaration . A solution that my colleague suggest is to find which function take long time to compile so:

    1. Go to Project select your target
    2. Build Settings -> Swift Compiler - Custom Flags
    3. Add to Other Swift Flags -Xfrontend -warn-long-function-bodies=50 (50 represent the time in milliseconds)

    after that a warning should displayed as follow:

    Getter 'frameDescription' took 108ms to type-check (limit: 50ms)

    and after that you know what to do ;)

提交回复
热议问题