react-native-charts-wrapper icon indicating copy to clipboard operation
react-native-charts-wrapper copied to clipboard

getting error in Xcode 14

Open anshumanburman opened this issue 1 year ago • 11 comments

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 avatar Jul 22 '22 11:07 anshumanburman

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

csantarin avatar Aug 03 '22 04:08 csantarin

@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

TomasSukenik avatar Sep 14 '22 12:09 TomasSukenik

@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

va1bhav avatar Sep 14 '22 13:09 va1bhav

Yes, please update this library - the iOS fix is in like @va1bhav pointed out above.

smadan avatar Sep 14 '22 22:09 smadan

Someone found a temporary fix for this waiting for a PR?

JohnBerd avatar Sep 15 '22 10:09 JohnBerd

Have anyone made a patch?

iyansr avatar Sep 15 '22 11:09 iyansr

@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 avatar Sep 15 '22 11:09 anshumanburman

@anshumanburman can you share more detail? i still dont get it 😁

iyansr avatar Sep 15 '22 11:09 iyansr

@iyansr https://github.com/iyansr Just you need to follow below steps

  1. first set up the patch configuration using below link https://github.com/doublesymmetry/cocoapods-patch
  2. run "pod patch create POD_NAME"
  3. 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() }

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

anshumanburman avatar Sep 15 '22 11:09 anshumanburman

Thanks @anshumanburman , will try

iyansr avatar Sep 15 '22 12:09 iyansr

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
     {

alwex avatar Sep 17 '22 02:09 alwex

Try v0.5.10, Thx.

wuxudong avatar Sep 24 '22 15:09 wuxudong

@wuxudong pod install error image platform :ios, '12.4' No error

showtan001 avatar Oct 19 '22 11:10 showtan001

react-native-charts-wrapper need ios min platform >= "12.0" Check you minimum deployment target in your config.

wuxudong avatar Oct 19 '22 14:10 wuxudong