Charts icon indicating copy to clipboard operation
Charts copied to clipboard

Fixes for Swift 5.7 compiler

Open lukeredpath opened this issue 2 years ago • 1 comments

Issue Link :link:

I'm currently experimenting with the latest development Swift 5.7 toolchain and the Charts library was not compiling due to a bug in the implementation of RangeReplaceableCollection on ChartDataItem.

This PR fixes that by adding the missing protocol method and also fixes a couple of compiler warnings (which I think also exist on the latest stable toolchain).

More info on this here: https://github.com/apple/swift/issues/58737 - the reason this compiled pre-5.7 was due to a bug in Swift which was due to be fixed in 5.6, reverted and will ship in 5.7 by the looks of it.

Goals :soccer:

Library can now be compiled with Swift 5.7.

Testing Details :mag:

Library continues to compile under 5.6.

I wasn't able to get the snapshots to pass on my M1 Max laptop - maybe I'm using the wrong simulator. The failures were very subtle and I don't think are related to this change.

lukeredpath avatar May 13 '22 23:05 lukeredpath

I also face other compiler errors:

    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 + Double(1.0)) * position + s) + Double(1.0) )
    }
        for case let set as RadarChartDataSetProtocol in (radarData as ChartData) where set.isVisible
        {
            drawDataSet(context: context, dataSet: set, mostEntries: mostEntries)
        }
        for case let set as CandleChartDataSetProtocol in (candleData as ChartData) where set.isVisible
        {
              drawDataSet(context: context, dataSet: set)
        }

from: https://github.com/danielgindi/Charts/issues/4860#issuecomment-1178968435

dangthaison91 avatar Jul 26 '22 11:07 dangthaison91

Any update when this could be reviewed and merged?

o15a3d4l11s2 avatar Aug 12 '22 08:08 o15a3d4l11s2

Any update when this could be reviewed and merged?

my comments above haven't resolved yet, not sure yet. I tried this PR with beta 3, however couldn't build & run.

Probably the latest time is when Xcode GM released and I can try it without bothering from beta releases.

liuxuan30 avatar Aug 25 '22 08:08 liuxuan30

Thanks for contributing!

pmairoldi avatar Aug 28 '22 00:08 pmairoldi

@pmairoldi do you have a deadline for a new version?

leohidalgo avatar Aug 29 '22 18:08 leohidalgo

Waiting for Xcode 14 gm before releasing anything.

pmairoldi avatar Aug 29 '22 18:08 pmairoldi

@pmairoldi The GM is here, let me know if I can help you with anything.

leohidalgo avatar Sep 07 '22 20:09 leohidalgo

Waiting for Xcode 14 gm before releasing anything.

thanks pal! been busy with the new job, as we also had tons of issues regarding Xcode 14 RC and iOS 16

liuxuan30 avatar Sep 09 '22 01:09 liuxuan30