Charts icon indicating copy to clipboard operation
Charts copied to clipboard

Support for Xcode 14

Open lukelabonte opened this issue 2 years ago • 10 comments

What did you do?

Build the project with Xcode 14 Beta 3

What did you expect to happen?

For the project to successfully build.

What happened instead?

There are 2 types of build errors

  1. Build error around CandleStickChartRenderer's and RadarChartRenderer's drawData(context: CGContext) where the IndexingIterator are not equivalent. Raw message:

error build: Referencing instance method 'makeIterator()' on 'Collection' requires the types 'IndexingIterator<ChartData>' and 'IndexingIterator<RadarChartData>' be equivalent

  1. Build error around ChartDataSet not conforming to RangeReplaceableCollection as replaceSubrange(_:with:) is missing. Raw messages:

error build: Type 'ChartDataSet' does not conform to protocol 'RangeReplaceableCollection'

error build: Unavailable instance method 'replaceSubrange(_:with:)' was used to satisfy a requirement of protocol 'RangeReplaceableCollection'

Charts Environment

Charts version/Branch/Commit Number: 4.0.3 Xcode version: Xcode 14 Beta 3 (14A5270f) Swift version: 5.7 Platform(s) running Charts: iOS macOS version running Xcode: 12.4 (21F79)

lukelabonte avatar Jul 06 '22 21:07 lukelabonte

Saw the same error this morning after upgraded to beta3. Beta 2 is fine, I guess for now I'll stick to beta 2 until this got resolved

dingtianran avatar Jul 06 '22 22:07 dingtianran

I resorted to just unlocking the files and resolving locally. Lasts until the pod gets reinstalled. For each:

  1. Commenting out the whole for case let... block
  2. Added this function to the bottom of the extension.
    public func replaceSubrange<C>(_ subrange: Swift.Range<Index>, with newElements: C) where C : Collection, Element == C.Element {
        fatalError()
    }

I know these aren't solutions, just unblocks me for now.

gsbernstein avatar Jul 07 '22 01:07 gsbernstein

@gsbernstein https://github.com/danielgindi/Charts/blob/c3701a4e5ce111c29dd7af9e19e6a346ccf0ad52/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift#L427-L431 from https://github.com/danielgindi/Charts/pull/4823

Brett-Best avatar Jul 07 '22 01:07 Brett-Best

will look into this. Is there any PR available already? Normally I would prefer beta 6 to start the fix

liuxuan30 avatar Jul 07 '22 09:07 liuxuan30

Xcode 14 beta 3 fixed the issue with EaseOutBack closure not resolving types in time.

So the only issues are the replaceSubrange which I linked to a potential fix above and I haven’t found a workaround for:

Build error around CandleStickChartRenderer's and RadarChartRenderer's drawData(context: CGContext) where the IndexingIterator are not equivalent.

Brett-Best avatar Jul 07 '22 10:07 Brett-Best

Xcode 14 beta 3 fixed the issue with EaseOutBack closure not resolving types in time.

So the only issues are the replaceSubrange which I linked to a potential fix above and I haven’t found a workaround for:

Build error around CandleStickChartRenderer's and RadarChartRenderer's drawData(context: CGContext) where the IndexingIterator are not equivalent.

#4823 is definitely something I would merge fast, but have to think about older swift versions, if nothing special, will get it merged. I have to squeeze my drive to make some pace for beta first...

liuxuan30 avatar Jul 08 '22 03:07 liuxuan30

Xcode 14 beta 3 fixed the issue with EaseOutBack closure not resolving types in time.

Not on my side (and I do have those two new errors too).

lchamp avatar Jul 08 '22 08:07 lchamp

for case let set as CandleChartDataSetProtocol in (candleData as ChartData) where set.isVisible
{
      drawDataSet(context: context, dataSet: set)
}

Makes CandleStickChartRenderer build.

juhanh avatar Jul 08 '22 13:07 juhanh

Just ran into this in Xcode 14 Beta 3 as well...and can't go back as I can't submit updates in Beta 2, beta season always fun 🤦‍♂️

gesabo avatar Jul 22 '22 22:07 gesabo

Xcode 14 beta 4 as well.

dobiho5 avatar Jul 28 '22 05:07 dobiho5

Xcode beta 5 doesn't fix it

nucauthu avatar Aug 08 '22 19:08 nucauthu

Will there any chance that the fix will be applied and solved before the Xcode 14 public release?

kevinho96 avatar Aug 18 '22 06:08 kevinho96

Will there any chance that the fix will be applied and solved before the Xcode 14 public release?

If not it's good time to say "good bye" for this library.

michalnowak061 avatar Aug 18 '22 21:08 michalnowak061

Xcode beta 5 doesn't fix it

It won't ever be fixed by a new release of Xcode because it was a known bug in Swift for quite some time, and has only recently been fixed in Swift 5.7

You can check out the original bug here: https://github.com/apple/swift/pull/38950

robnadin avatar Aug 23 '22 15:08 robnadin

Any updates on if this is going to be addressed soon? Xcode 14 is a month out.

logancautrell avatar Aug 23 '22 22:08 logancautrell

If I'm not mistaken, there are some PRs waiting for approval, which are fixing the issue. Can we merge them?

bardonadam avatar Aug 24 '22 07:08 bardonadam

It looks like said PRs have been merged. Any timeline on a new release?

waterskier2007 avatar Aug 30 '22 17:08 waterskier2007

@waterskier2007 Indeed and code just works fine.

If you do not want to wait until public release you can simply specify branch "master" and not the version.

phoenisis avatar Aug 30 '22 18:08 phoenisis

I will release a new version when Xcode gm become available

pmairoldi avatar Aug 30 '22 18:08 pmairoldi

With the RC now available, what are the chances on a new release?

waterskier2007 avatar Sep 08 '22 17:09 waterskier2007

@pmairoldi any updates?

waterskier2007 avatar Sep 12 '22 13:09 waterskier2007

I was off for the last couple days. I will look at it tonight.

pmairoldi avatar Sep 12 '22 13:09 pmairoldi

closed by https://github.com/danielgindi/Charts/releases/tag/v4.1.0

pmairoldi avatar Sep 13 '22 02:09 pmairoldi

closed by https://github.com/danielgindi/Charts/releases/tag/v4.1.0

It is installing the 3.6.0 with pod 'Charts'.

DanieleCiti avatar Sep 13 '22 11:09 DanieleCiti

@DanieleCiti - try increasing the minimum deployment target to 14.0 in your podfile. that should resolve the issue.

jonnokim17 avatar Sep 13 '22 11:09 jonnokim17

@DanieleCiti - try increasing the minimum deployment target to 14.0 in your podfile. that should resolve the issue.

Done it and I only have one error now: No such module 'Algorithms'

DanieleCiti avatar Sep 13 '22 11:09 DanieleCiti

@DanieleCiti - i ran into that as well. i just deleted the charts pod and went with swift package instead, which worked.

jonnokim17 avatar Sep 13 '22 11:09 jonnokim17

@DanieleCiti - i ran into that as well. i just deleted the charts pod and went with swift package instead, which worked.

I'm gonna do the same -> Adding a package with "Up to next major 4.1.0 < 4.0.0" from https://github.com/danielgindi/Charts.git. That's what you did too?

DanieleCiti avatar Sep 13 '22 11:09 DanieleCiti

@DanieleCiti - yep!

jonnokim17 avatar Sep 13 '22 11:09 jonnokim17

@DanieleCiti - yep!

Thanks a lot for your time! It taking a bit of time on the "fetching https://github.com/danielgindi/Charts.git" screen. How long did it takes for you to finish?

DanieleCiti avatar Sep 13 '22 11:09 DanieleCiti