Hello, I'm working on a Swift project which uses a C (static) library (packed in xcframework), and encounter this weird slow compile time, currently temporarily solved by slightly modifying the code.
For example, the code below takes forever to compile on my laptop, CPU 100%, fan goes crazy, battery drains quickly, etc., don't even bother waiting for it to finish
var bigCStruct1 = big_c_struct_1()
var bigCStruct2 = big_c_struct_2()
But after simply rearranging the code, the code compiles fine, although still a bit slow
var bigCStruct2 = big_c_struct_2()
var bigCStruct1 = big_c_struct_1()
Another example, code below won't finish compiling
func setUpBigCStruct() -> big_c_struct {
var bigCStruct = big_c_struct()
// ...more code here...
return bigCStruct
}
// this is global
let bigCStruct = setUpBigCStruct()
But changing it into below will somehow make it work
// this is global
var bigCStruct = big_c_struct()
func setUpBigCStruct() {
// ...access, modify bigCStruct here...
}
setUpBigCStruct()
Why??? Help, what am I doing wrong? Never encountered this problem before. This is really frustrating