From e957dbe2826ab0b2a55740e4be8d8a56833211c6 Mon Sep 17 00:00:00 2001 From: Joost van den Akker Date: Thu, 27 Aug 2020 22:02:48 +0200 Subject: [PATCH] Fix explicit .self errors in Xcode 11 Fixes #157 --- Sources/SwiftUICharts/Base/Label/ChartLabel.swift | 2 +- Sources/SwiftUICharts/Charts/LineChart/Line.swift | 2 +- Sources/SwiftUICharts/Charts/PieChart/PieChartRow.swift | 8 ++++---- Sources/SwiftUICharts/Charts/RingsChart/Ring.swift | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Sources/SwiftUICharts/Base/Label/ChartLabel.swift b/Sources/SwiftUICharts/Base/Label/ChartLabel.swift index 96a86303..460d6a5d 100644 --- a/Sources/SwiftUICharts/Base/Label/ChartLabel.swift +++ b/Sources/SwiftUICharts/Base/Label/ChartLabel.swift @@ -97,7 +97,7 @@ public struct ChartLabel: View { self.textToDisplay = self.title } .onReceive(self.chartValue.objectWillChange) { _ in - self.textToDisplay = self.chartValue.interactionInProgress ? String(format: format, self.chartValue.currentValue) : self.title + self.textToDisplay = self.chartValue.interactionInProgress ? String(format: self.format, self.chartValue.currentValue) : self.title } if !self.chartValue.interactionInProgress { Spacer() diff --git a/Sources/SwiftUICharts/Charts/LineChart/Line.swift b/Sources/SwiftUICharts/Charts/LineChart/Line.swift index 942342de..9cc7a414 100644 --- a/Sources/SwiftUICharts/Charts/LineChart/Line.swift +++ b/Sources/SwiftUICharts/Charts/LineChart/Line.swift @@ -77,7 +77,7 @@ public struct Line: View { self.frame = geometry.frame(in: .local) } - .onReceive(orientationChanged) { _ in + .onReceive(self.orientationChanged) { _ in // When we receive notification here, the geometry is still the old value // so delay evaluation to get the new frame! DispatchQueue.main.async { diff --git a/Sources/SwiftUICharts/Charts/PieChart/PieChartRow.swift b/Sources/SwiftUICharts/Charts/PieChart/PieChartRow.swift index f812a17e..464c5bfb 100644 --- a/Sources/SwiftUICharts/Charts/PieChart/PieChartRow.swift +++ b/Sources/SwiftUICharts/Charts/PieChart/PieChartRow.swift @@ -45,7 +45,7 @@ public struct PieChartRow: View { backgroundColor: self.style.backgroundColor.startColor, accentColor: self.style.foregroundColor.rotate(for: index) ) - .scaleEffect(currentTouchedIndex == index ? 1.1 : 1) + .scaleEffect(self.currentTouchedIndex == index ? 1.1 : 1) .animation(Animation.spring()) } } @@ -55,13 +55,13 @@ public struct PieChartRow: View { let isTouchInPie = isPointInCircle(point: value.location, circleRect: rect) if isTouchInPie { let touchDegree = degree(for: value.location, inCircleRect: rect) - currentTouchedIndex = slices.firstIndex(where: { $0.startDeg < touchDegree && $0.endDeg > touchDegree }) ?? -1 + self.currentTouchedIndex = self.slices.firstIndex(where: { $0.startDeg < touchDegree && $0.endDeg > touchDegree }) ?? -1 } else { - currentTouchedIndex = -1 + self.currentTouchedIndex = -1 } }) .onEnded({ value in - currentTouchedIndex = -1 + self.currentTouchedIndex = -1 }) ) } diff --git a/Sources/SwiftUICharts/Charts/RingsChart/Ring.swift b/Sources/SwiftUICharts/Charts/RingsChart/Ring.swift index dee10540..49889a00 100644 --- a/Sources/SwiftUICharts/Charts/RingsChart/Ring.swift +++ b/Sources/SwiftUICharts/Charts/RingsChart/Ring.swift @@ -114,7 +114,7 @@ struct Ring: View { // Background for the ring. Use the final color with reduced opacity RingShape() .stroke(style: StrokeStyle(lineWidth: self.ringWidth)) - .fill(lastGradientColor.opacity(0.142857)) + .fill(self.lastGradientColor.opacity(0.142857)) // Foreground RingShape(percent: self.percent, startAngle: self.startAngle) .stroke(style: StrokeStyle(lineWidth: self.ringWidth, lineCap: .round))