UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

SOLVED: Xcode 12 Error: "Expression was too complex to be solved in reasonable time..", but no error in Xcode 11.7

Forums > SwiftUI

Hey everyone, I am really frustrated and hope that you can help me solving the issue... I can build my SwiftUI App without an error in Xcode 11.7, but in Xcode 12 I am getting the Error: "Expression was too complex to be solved in reasonable time.." in two files. I tried to remove modifiers, reinstalled Xcode, restarted the mac. Only when I commented out the most of the code it build without the error, when I commented out smaller pieces it gave me everytime the error...

Any Ideas?

2      

hi Robert,

you should show the code snippet or two where, if commented out, you do not get the error (i.e., the lines that cause the error when included).

in some cases in XCode 11, i have found that simple things, like .frame() modifiers that use CGFloat arguments, cause confusion with anything much other than a direct expression. one example might be a modifier of the form

xxxxx.frame(width: isActive ? 32 : 49, height: CGFloat(myArray.count * 44)/CGFloat(myInteger), ...)

this would go through the compiler more easily as

xxxxx.frame(width: myWidth(), height: myHeight(), ...)

where myWidth and myHeight are functions that return CGFloat results for these same computations.

of course, that doesn't excuse XCode 12 for any sort of regression you might be seeing.

hope that helps,

DMG

3      

Hi

Can you refactor the View into other view structs therefore having a smaller View which the complier will be able to solve in a reasonable time

3      

I solved it by replacing a GeometryView for the whole view with 2-3 smaller Geometry Views...

2      

Hacking with Swift is sponsored by RevenueCat

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.