The compiler is unable to type-check this expression in reasonable time

Hello the community, how are you?

Since few days, this messages displays as an error into my code: "The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions" Since all these days, I'm not able to solve this problem. My app is almost done and the code is good. But I don't find where the problem is from.
Here's the code:

I am unable to replicate the compilation error on my 2019 Intel iMac with macOS 15.3.2, Xcode 16.2 and Swift 6.0.3. My suggestion is to move your subviews into their own structs, and move any reassignment of memory logic to their own functions (doing exactly what the error says; try breaking up the expression into distinct sub-expressions).

It is worth mentioning this problem is very common, especially when working with SwiftUI. You need to provide more data (all structs, classes and enums used) to try replicating the problem from one machine to another as I had to fill in some blanks to get it to compile successfully due to missing symbols.

2 Likes

Thanks a lot, it worked! :smiley: