Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Charts not compile on Xcode 14

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'.

like image 232
Saurabh Sharma Avatar asked Sep 02 '25 18:09

Saurabh Sharma


2 Answers

Append it to extension ChartDataSet: RangeReplaceableCollection

public func replaceSubrange<C>(_ subrange: Swift.Range<Int>, with newElements: C) where C : Collection, ChartDataEntry == C.Element {
    entries.replaceSubrange(subrange, with: newElements)
    notifyDataSetChanged()
}
like image 68
Saurabh Sharma Avatar answered Sep 04 '25 11:09

Saurabh Sharma


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: `

pod 'Charts', :git => 'https://github.com/danielgindi/Charts.git', :branch => 'master'

like image 35
Artsem Sharubin Avatar answered Sep 04 '25 12:09

Artsem Sharubin