Charts
Charts copied to clipboard
ChartAnimationEasing.swift file getting compiler error error on Xcode14-beta
What did you do?
I tried to run my application with Xcode 14 Beta and in Charts pod ChartAnimationEasing.swift file there's an error with this function
internal static let EaseOutBack = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in
let s: TimeInterval = 1.70158
var position: TimeInterval = elapsed / duration
position -= 1.0
return Double( position * position * ((s + 1.0) * position + s) + 1.0 )
}
The error says that The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions. Is there anything I can do with it ?
I expect to run my application without any error however the Chart file getting error that relational with type-checking
Charts Environment
My podfile includes Charts like default
pod 'Charts'
Charts version/Branch/Commit Number: **Xcode version: Version 14.0 beta (14A5228q) **Swift version: swift-driver version: 1.45.2 Apple Swift version 5.6 (swiftlang-5.6.0.323.62 clang-1316.0.20.8) Platform(s) running Charts: Xcode 14.0 Beta as I described, tried to run into multiple simulators and real devices macOS version running Xcode: MacOS Monterey 12.4 (21F79) CommandLineTool: Xcode14 14A5228q
The issue here isn't with charts. My guess is that it's this line:
return Double( position * position * ((s + 1.0) * position + s) + 1.0 )
Try separating that into components and provide strict types for the 1.0 values and it shield resolve.
Above function is part of ChartAnimationEasing.swift file so it should be fixed on framework side.
Try separating that into components and provide strict types for the 1.0 values and it shield resolve.
Suggestion passes compiler checks.
return Double( position * position * ((s + Double(1.0)) * position + s) + Double(1.0) )
hey people, sorry for late reply, yesterday we tried new Xcode14 beta and there was an error which I described it already.
After that I separate all of the items as a variable, it worked and successfully run my project into Xcode 14.
I achieved it with a so simple way with
let positionSquare = position * position
let sPlusOne = s + Double(1.0)
....
then
return Double(positionSquare * (sPlusOne * .....))
but with a single line of which @McSims-Ubi described we can handle it. I am opening a pull request asap and link my issue as #4835 and after that it would be resolved, after that I open PR, I will comment in here.
Hello guys, again
I just create a pull request you can see here -> https://github.com/danielgindi/Charts/pull/4836
Thanks for comments @richardpineo @McSims-Ubi
Weirdly, replacing either instance of 1.0 with Double(1.0) in that line lets it compile -- it doesn't even require replacing both.
As noted in #4838, adding Charts as a Swift Package instead of Cocoapod, or changing the closure declaration to a func also let it compile successfully.
Same error with Xcode 14 beta 2
pr has open and needs to approval for the workflow
People, the Charts library seems not to support beta as they say and you can see in the PR, if you need to fix it open the file and edit the line with
return Double( position * position * ((s + Double(1.0)) * position + s) + Double(1.0) ) for now with unlocking the file until Xcode 14 GM release, so this issue will be open for a while
建议把最后return代码分开,swift不建议此操作通过一行解决
Seems to be fixed in Xcode 14 beta 3.
Seems to be fixed in Xcode 14 beta 3.
Still not working on Xcode14b3 for me (I did delete DerivedData + Clean Build Folder)

Seems to be fixed in Xcode 14 beta 3.
closed by https://github.com/danielgindi/Charts/releases/tag/v4.1.0
To break up the expression into distinct sub-expressions, you can try separating out each part of the calculation into its own intermediate variable. Here is one way you could do this:
internal static let EaseOutBack = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in let s: TimeInterval = 1.70158 var position: TimeInterval = elapsed / duration position -= 1.0 let a = position * position let b = (s + 1.0) * position let c = a * (b + s) let result = c + 1.0 return Double(result) } I hope this helps! Let me know if you have any further questions.
The issue here isn't with charts. My guess is that it's this line:
return Double( position * position * ((s + 1.0) * position + s) + 1.0 )Try separating that into components and provide strict types for the1.0values and it shield resolve.
Thanks a lot it worked. Here is the code if anyone wants to refer. Thank You.
let multiplication = position * position return Double(multiplication * ((s + 1.0) * position + s) + 1.0)
