I'm getting an error when trying to compile my project using xcode 12.
The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
The compiler hints that the error is at the last modifier .offset() in this snippet:
The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
The compiler hints that the error is at the last modifier .offset() in this snippet:
Code Block swift func circle(geometry: GeometryProxy, index: Int) -> some View { return Circle() .fill(Color.mediumGray) .frame(width: geometry.size.width / 5, height: geometry.size.height / 5) .scaleEffect(!self.isAnimating ? 1 - CGFloat(index) / 4 : 0.1 + CGFloat(index) / 5) .offset(y: geometry.size.width / 10 - geometry.size.height / 2) }
This seems to be a bug in the compiler where it takes too long to produce the correct diagnostic. It isn't necessarily related to the .offset modifier - this is just the line where the expression ends.
It looks like the real issue is that Color doesn't have a member called mediumGray. When I comment out the last 2 modifiers, that is the error message I get. The following code does compile in an iOS project in Xcode 12 using Color.gray instead of Color.mediumGray:
Could you please file a bug using Feedback Assistant and attach your Xcode project? Thank you!
It looks like the real issue is that Color doesn't have a member called mediumGray. When I comment out the last 2 modifiers, that is the error message I get. The following code does compile in an iOS project in Xcode 12 using Color.gray instead of Color.mediumGray:
Code Block struct ContentView: View { var isAnimating: Bool func circle(geometry: GeometryProxy, index: Int) -> some View { return Circle() .fill(Color.gray) .frame(width: geometry.size.width / 5, height: geometry.size.height / 5) .scaleEffect(!self.isAnimating ? 1 - CGFloat(index) / 4 : 0.1 + CGFloat(index) / 5) .offset(y: geometry.size.width / 10 - geometry.size.height / 2) } var body: some View { ... } }
Could you please file a bug using Feedback Assistant and attach your Xcode project? Thank you!