Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChartAnimationEasing.swift file getting compiler error error on Xcode14-beta #4835

Closed
eliakorkmaz opened this issue Jun 7, 2022 · 15 comments
Assignees

Comments

@eliakorkmaz
Copy link
Contributor

eliakorkmaz commented Jun 7, 2022

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

@richardpineo
Copy link

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.

@McSims-Ubi
Copy link

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) )

@eliakorkmaz
Copy link
Contributor Author

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.

@eliakorkmaz
Copy link
Contributor Author

Hello guys, again

I just create a pull request you can see here -> #4836

Thanks for comments @richardpineo @McSims-Ubi

@erichedstrom
Copy link

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.

@lchamp
Copy link

lchamp commented Jun 23, 2022

Same error with Xcode 14 beta 2

@eliakorkmaz
Copy link
Contributor Author

pr has open and needs to approval for the workflow

@eliakorkmaz
Copy link
Contributor Author

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

@cnjsyyb
Copy link

cnjsyyb commented Jul 2, 2022

建议把最后return代码分开,swift不建议此操作通过一行解决

@Brett-Best
Copy link

Seems to be fixed in Xcode 14 beta 3.

@lchamp
Copy link

lchamp commented Jul 8, 2022

Seems to be fixed in Xcode 14 beta 3.

Still not working on Xcode14b3 for me (I did delete DerivedData + Clean Build Folder)
screenshot

@mvn-thanhnguyen4-dn
Copy link

Seems to be fixed in Xcode 14 beta 3.

Screen Shot 2022-07-08 at 15 46 06

@pmairoldi pmairoldi self-assigned this Aug 27, 2022
pmairoldi added a commit that referenced this issue Aug 28, 2022
Add double mark for compiler check related with issue #4835
@pmairoldi
Copy link
Collaborator

zebraciam added a commit to zebraciam/Charts that referenced this issue Sep 14, 2022
* master: (35 commits)
  fix ios tests
  fix ios tests
  fix tvos tests
  udpate ci
  update ci
  update ci
  update readme
  update ci
  update ci
  Release 4.1
  fix 'makeIterator()' on 'Collection' requires the types to be equivalent
  Fix yOffset documentation typo
  Update README.md
  Fix warnings
  Fixes protocol implementation when compiled with Swift 5.7
  Fix navigation bar transparent issue
  Update ChartDataSet.swift
  Add double mark for compiler check related with issue ChartsOrg#4835
  used index APIs instead of raw integers
  return last index for every rounding
  ...
thyadang-techlabs pushed a commit to thyadang-techlabs/Charts that referenced this issue Oct 4, 2022
* commit '203700608a6e956e591e7387d77423fa3fea6947': (35 commits)
  fix ios tests
  fix ios tests
  fix tvos tests
  udpate ci
  update ci
  update ci
  update readme
  update ci
  update ci
  Release 4.1
  fix 'makeIterator()' on 'Collection' requires the types to be equivalent
  Fix yOffset documentation typo
  Update README.md
  Fix warnings
  Fixes protocol implementation when compiled with Swift 5.7
  Fix navigation bar transparent issue
  Update ChartDataSet.swift
  Add double mark for compiler check related with issue ChartsOrg#4835
  used index APIs instead of raw integers
  return last index for every rounding
  ...

# Conflicts:
#	Package.swift
zwneng added a commit to zwneng/Charts that referenced this issue Nov 12, 2022
* 'master' of github.com:zwneng/Charts: (22 commits)
  fix ios tests
  fix ios tests
  fix tvos tests
  udpate ci
  update ci
  update ci
  update readme
  update ci
  update ci
  Release 4.1
  fix 'makeIterator()' on 'Collection' requires the types to be equivalent
  Fix yOffset documentation typo
  Update README.md
  Fix warnings
  Fixes protocol implementation when compiled with Swift 5.7
  Fix navigation bar transparent issue
  Update ChartDataSet.swift
  Add double mark for compiler check related with issue ChartsOrg#4835
  used index APIs instead of raw integers
  return last index for every rounding
  ...
@Aiming9793
Copy link

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.

zhz821 pushed a commit to felicapocket/Charts that referenced this issue Apr 23, 2023
danielwischer added a commit to danielwischer/Charts that referenced this issue Apr 29, 2023
@AagamVora24
Copy link

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.

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)

nolano pushed a commit to nolano/Charts that referenced this issue Jan 15, 2024
* master: (22 commits)
  fix ios tests
  fix ios tests
  fix tvos tests
  udpate ci
  update ci
  update ci
  update readme
  update ci
  update ci
  Release 4.1
  fix 'makeIterator()' on 'Collection' requires the types to be equivalent
  Fix yOffset documentation typo
  Update README.md
  Fix warnings
  Fixes protocol implementation when compiled with Swift 5.7
  Fix navigation bar transparent issue
  Update ChartDataSet.swift
  Add double mark for compiler check related with issue ChartsOrg#4835
  used index APIs instead of raw integers
  return last index for every rounding
  ...

# Conflicts:
#	Source/Charts/Data/Implementations/Standard/ChartDataSet.swift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests