简体   繁体   中英

Swift UI Xcode 11 beta 5 - Error when building

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM