I'm having this error 'The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions' every-time I try to build my app and every-time I build the error is in a different view and in different parts of the code. Normally it shows where I have a ForEach or a .sheet Presentation but there are views that have them and they don't give an error. This only happened when I updated to xCode 11 beta 5, is anyone with the same error?
Already tried to replace the ForEach and .sheet on the views but there are views that have ForEach and they don't give an error and they exactly the same.
The expected result is not having that error when compiling, but for some reason it always shows: 'The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions'
I had that problem, and it is documented in the last release notes (beta 5):
Using a ForEach view with a complex expression in its closure can may result in compiler errors. Workaround: Extract those expressions into their own View types. (53325810)
When you get the The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions error, ignore all other errors, as they cannot be trusted. First you need to address the "reasonable time" problem.
You need to encapsulate the contents of the ForEach, and it will most likely go away.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With