Xcode 8 very slow Swift compiling

后端 未结 8 1492
太阳男子
太阳男子 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条回答
  •  Happy的楠姐
    2020-12-12 14:43

    I was able to greatly reduce my swift project compile times by avoiding the use the Nil-Coalescing Operator and string concatenation.

    In otherwords where I had something like:

    let x = "one" + object.nullableProperty ?? ""
    

    I changed it to

    let x = String(format: "one %@", object.nullableProperty ?? "")
    

    My compile times have dropped drastically- from 20 minutes to 20 seconds.

提交回复
热议问题