I am facing following errors in library –
-
Type ‘ChartDataSet‘ does not conform to protocol ‘RangeReplaceableCollection‘
-
Unavailable instance method ‘replaceSubrange(_:with:)‘ was used to satisfy a requirement of protocol ‘RangeReplaceableCollection‘.
6
Answers
Append it to extension ChartDataSet: RangeReplaceableCollection
It was fixed on Master brunch
Add master brunch to your project, instead of "Up to next major version" in SPM.
And use in CacaoPods: `
I have newly installed XCode 14.1 and found multiple error on the
Charts
cocoapod library. Found multiple solutions online but none worked fully and made sense to me. Finally using swift package manager forCharts
solved the problem like a charm.Solution: Remove
Charts
pod from Podfile and add SPM (Swift Package Manager) for the same using url:Make sure you change version to:
Same thing happened to me.
I am using the swift package manager to import charts and the error went away after updating the swift package manager. However, the charts version remains 4.0. Packages other than charts may be the culprit.
I am using Xcode 14.2. I removed the Charts from the podFile and then added it via SPM. However, beware to only include Charts (4.1.0) and not Dynamic Charts. The latter will result in a "Module not found" error for Algorithms
Increase the platform version to platform :ios, ‘12.0’ or above in your Podfile.
And then add pod ‘Charts’ into the pod file. Then hit pod install in the terminal, the version installed will be 14.0.1 which is currently the latest, this will resolve the issue.
If you face issue with initializing charts after the above step then add this piece of code to resolve the error,