react-native-charts-wrapper
react-native-charts-wrapper copied to clipboard
getting error in Xcode 14
Unavailable instance method 'replaceSubrange(_:with:)' was used to satisfy a requirement of protocol 'RangeReplaceableCollection'.
getting above error when running on Xcode 14.
I have fixed this error after adding below code.
public func replaceSubrange<C>(_ subrange: Swift.Range<Index>, with newElements: C) where C : Collection, Element == C.Element
{
entries.replaceSubrange(subrange, with: newElements)
notifyDataSetChanged()
}
in https://github.com/danielgindi/Charts/blob/c3701a4e5ce111c29dd7af9e19e6a346ccf0ad52/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift#L427-L431 file
@anshumanburman Got this on my end, too.
But! I highly doubt this library can do a lot about that until https://github.com/danielgindi/Charts/issues/4860 fixes it officially. That or this library must now start forking Charts
...
@anshumanburman Got this on my end, too.
But! I highly doubt this library can do a lot about that until danielgindi/Charts#4860 fixes it officially. That or this library must now start forking
Charts
...
It seems they fixed it https://github.com/danielgindi/Charts/releases/tag/v4.1.0
@wuxudong Could you please update this library to use latest Charts pod release which fixes issue with Xcode 14? Thank you!
https://github.com/danielgindi/Charts/releases/tag/v4.1.0
Yes, please update this library - the iOS fix is in like @va1bhav pointed out above.
Someone found a temporary fix for this waiting for a PR?
Have anyone made a patch?
@I Putu Saputrayana i have fixed this issue after creating a patch file into my code. Please refer to the cocoapod-patch to fix this.
On Thu, Sep 15, 2022 at 4:30 PM I Putu Saputrayana @.***> wrote:
Have anyone made a patch?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
-- Thanks and Regards Anshuman Burmman
@anshumanburman can you share more detail? i still dont get it 😁
@iyansr https://github.com/iyansr Just you need to follow below steps
- first set up the patch configuration using below link https://github.com/doublesymmetry/cocoapods-patch
- run "pod patch create POD_NAME"
- after this you need to update the code into the pod file like below
public func replaceSubrange<C>(_ subrange: Swift.Range<Index>, with newElements: C) where C : Collection, Element == C.Element { entries.replaceSubrange(subrange, with: newElements) notifyDataSetChanged() }
- then run "pod patch apply POD_NAME"
these steps worked for me.
On Thu, Sep 15, 2022 at 5:17 PM I Putu Saputrayana @.***> wrote:
@anshumanburman https://github.com/anshumanburman can you share more detail? i still dont get it 😁
— Reply to this email directly, view it on GitHub https://github.com/wuxudong/react-native-charts-wrapper/issues/879#issuecomment-1247994322, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGV6II4S5ZCOVM7NCGYKS53V6MEGBANCNFSM54LGOCLA . You are receiving this because you were mentioned.Message ID: @.***>
--
Thanks and Regards Anshuman Burmman
Thanks @anshumanburman , will try
In case someone has the same issue as me, I also had to apply this patch:
internal static func EaseOutBack(elapsed: TimeInterval, duration: TimeInterval) -> Double {
let s: TimeInterval = 1.70158
var position: TimeInterval = elapsed / duration
position -= 1.0
return Double( position * position * ((s + 1.0) * position + s) + 1.0 )
}
as described here: https://github.com/danielgindi/Charts/issues/4838#issuecomment-1152975643
Here is my entire patch file for reference:
diff --git a/cocoapods-patch-20220917-1291-udawgx/Charts/Source/Charts/Animation/ChartAnimationEasing.swift b/Pods/Charts/Source/Charts/Animation/ChartAnimationEasing.swift
index 58b0b632..8436f215 100644
--- a/cocoapods-patch-20220917-1291-udawgx/Charts/Source/Charts/Animation/ChartAnimationEasing.swift
+++ b/Pods/Charts/Source/Charts/Animation/ChartAnimationEasing.swift
@@ -337,7 +337,7 @@ internal struct EasingFunctions
return Double( position * position * ((s + 1.0) * position - s) )
}
- internal static let EaseOutBack = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in
+ internal static func EaseOutBack(elapsed: TimeInterval, duration: TimeInterval) -> Double {
let s: TimeInterval = 1.70158
var position: TimeInterval = elapsed / duration
position -= 1.0
diff --git a/cocoapods-patch-20220917-1291-udawgx/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift b/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift
index 9922878d..3f110b38 100644
--- a/cocoapods-patch-20220917-1291-udawgx/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift
+++ b/Pods/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift
@@ -424,6 +424,12 @@ open class ChartDataSet: ChartBaseDataSet
return true
}
+ public func replaceSubrange<C>(_ subrange: Swift.Range<Index>, with newElements: C) where C : Collection, Element == C.Element
+ {
+ entries.replaceSubrange(subrange, with: newElements)
+ notifyDataSetChanged()
+ }
+
@available(*, renamed: "remove(_:)")
open override func removeEntry(_ entry: ChartDataEntry) -> Bool
{
Try v0.5.10, Thx.
@wuxudong
pod install error
platform :ios, '12.4' No error
react-native-charts-wrapper need ios min platform >= "12.0" Check you minimum deployment target in your config.