diff --git a/Package.resolved b/Package.resolved deleted file mode 100644 index 888ca3b156..0000000000 --- a/Package.resolved +++ /dev/null @@ -1,25 +0,0 @@ -{ - "object": { - "pins": [ - { - "package": "swift-algorithms", - "repositoryURL": "https://github.com/apple/swift-algorithms", - "state": { - "branch": null, - "revision": "b14b7f4c528c942f121c8b860b9410b2bf57825e", - "version": "1.0.0" - } - }, - { - "package": "swift-numerics", - "repositoryURL": "https://github.com/apple/swift-numerics", - "state": { - "branch": null, - "revision": "0a5bc04095a675662cf24757cc0640aa2204253b", - "version": "1.0.2" - } - } - ] - }, - "version": 1 -} diff --git a/Package.swift b/Package.swift index c4da97173c..9e7440f7eb 100644 --- a/Package.swift +++ b/Package.swift @@ -19,13 +19,9 @@ let package = Package( targets: ["Charts"]) ], dependencies: [ - .package(url: "https://github.com/apple/swift-algorithms", from: "1.0.0") ], targets: [ - .target( - name: "Charts", - dependencies: [.product(name: "Algorithms", package: "swift-algorithms")] - ) + .target(name: "Charts") ], swiftLanguageVersions: [.v5] ) diff --git a/Source/Charts/Highlight/ChartHighlighter.swift b/Source/Charts/Highlight/ChartHighlighter.swift index f1f1873386..08b75ac89b 100644 --- a/Source/Charts/Highlight/ChartHighlighter.swift +++ b/Source/Charts/Highlight/ChartHighlighter.swift @@ -9,7 +9,6 @@ // https://github.com/danielgindi/Charts // -import Algorithms import Foundation import CoreGraphics @@ -74,7 +73,7 @@ open class ChartHighlighter : NSObject, Highlighter guard let data = self.data else { return vals } - for (i, set) in data.indexed() where set.isHighlightEnabled + for (i, set) in zip(data.indices, data) where set.isHighlightEnabled { // extract all y-values from all DataSets at the given x-value. // some datasets (i.e bubble charts) make sense to have multiple values for an x-value. We'll have to find a way to handle that later on. It's more complicated now when x-indices are floating point. diff --git a/Source/Charts/Highlight/CombinedHighlighter.swift b/Source/Charts/Highlight/CombinedHighlighter.swift index 0a03db2301..40c254cfbf 100644 --- a/Source/Charts/Highlight/CombinedHighlighter.swift +++ b/Source/Charts/Highlight/CombinedHighlighter.swift @@ -9,7 +9,6 @@ // https://github.com/danielgindi/Charts // -import Algorithms import Foundation import CoreGraphics @@ -36,8 +35,10 @@ open class CombinedHighlighter: ChartHighlighter let dataObjects = chart.combinedData?.allData else { return vals } - for (i, dataObject) in dataObjects.indexed() + for i in dataObjects.indices { + let dataObject = dataObjects[i] + // in case of BarData, let the BarHighlighter take over if barHighlighter != nil && dataObject is BarChartData, let high = barHighlighter?.getHighlight(x: x, y: y) @@ -47,7 +48,7 @@ open class CombinedHighlighter: ChartHighlighter } else { - for (j, set) in dataObject.indexed() where set.isHighlightEnabled + for (j, set) in zip(dataObject.indices, dataObject) where set.isHighlightEnabled { let highs = buildHighlights(dataSet: set, dataSetIndex: j, xValue: xValue, rounding: .closest) diff --git a/Source/Charts/Highlight/RadarHighlighter.swift b/Source/Charts/Highlight/RadarHighlighter.swift index d01cb4fd6f..e5f087e00f 100644 --- a/Source/Charts/Highlight/RadarHighlighter.swift +++ b/Source/Charts/Highlight/RadarHighlighter.swift @@ -49,7 +49,7 @@ open class RadarHighlighter: PieRadarHighlighter let sliceangle = chart.sliceAngle let factor = chart.factor - for (i, dataSet) in chartData.indexed() + for (i, dataSet) in zip(chartData.indices, chartData) { guard let entry = dataSet.entryForIndex(index) else { continue } diff --git a/Source/Charts/Renderers/YAxisRendererRadarChart.swift b/Source/Charts/Renderers/YAxisRendererRadarChart.swift index 3b3cde0bf8..a47bf6ac18 100644 --- a/Source/Charts/Renderers/YAxisRendererRadarChart.swift +++ b/Source/Charts/Renderers/YAxisRendererRadarChart.swift @@ -151,7 +151,7 @@ open class YAxisRendererRadarChart: YAxisRenderer let xOffset = axis.labelXOffset let entries = axis.entries[from..