Skip to content

Commit

Permalink
Fix Xcode 14 compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
son.dang committed Aug 2, 2022
1 parent b38b8d4 commit 696c6e5
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Source/Charts/Animation/ChartAnimationEasing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ internal struct EasingFunctions
let s: TimeInterval = 1.70158
var position: TimeInterval = elapsed / duration
position -= 1.0
return Double( position * position * ((s + 1.0) * position + s) + 1.0 )
return position * position * ((s + 1.0) * position + s) + 1.0
}

internal static let EaseInOutBack = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,11 @@ extension ChartDataSet: RandomAccessCollection {

// MARK: RangeReplaceableCollection
extension ChartDataSet: RangeReplaceableCollection {
public func replaceSubrange<C>(_ subrange: Swift.Range<Index>, with newElements: C) where C : Collection, Element == C.Element {
entries.replaceSubrange(subrange, with: newElements)
notifyDataSetChanged()
}

public func append(_ newElement: Element) {
calcMinMax(entry: newElement)
entries.append(newElement)
Expand Down
4 changes: 2 additions & 2 deletions Source/Charts/Renderers/CandleStickChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ open class CandleStickChartRenderer: LineScatterCandleRadarRenderer
accessibleChartElements.append(element)
}

for case let set as CandleChartDataSetProtocol in candleData where set.isVisible
for case let dataSet as CandleChartDataSetProtocol in (candleData as ChartData) where dataSet.isVisible
{
drawDataSet(context: context, dataSet: set)
drawDataSet(context: context, dataSet: dataSet)
}
}

Expand Down
6 changes: 3 additions & 3 deletions Source/Charts/Renderers/PieChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ open class PieChartRenderer: NSObject, DataRenderer
// If we redraw the data, remove and repopulate accessible elements to update label values and frames
accessibleChartElements.removeAll()

for case let set as PieChartDataSetProtocol in pieData where
set.isVisible && set.entryCount > 0
for case let dataSet as PieChartDataSetProtocol in pieData where
dataSet.isVisible && dataSet.entryCount > 0
{
drawDataSet(context: context, dataSet: set)
drawDataSet(context: context, dataSet: dataSet)
}
}

Expand Down
4 changes: 2 additions & 2 deletions Source/Charts/Renderers/RadarChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ open class RadarChartRenderer: LineRadarRenderer
withDefaultDescription: "Radar Chart")
self.accessibleChartElements.append(element)

for case let set as RadarChartDataSetProtocol in radarData where set.isVisible
for case let dataSet as RadarChartDataSetProtocol in (radarData as ChartData) where dataSet.isVisible
{
drawDataSet(context: context, dataSet: set, mostEntries: mostEntries)
drawDataSet(context: context, dataSet: dataSet, mostEntries: mostEntries)
}
}

Expand Down
6 changes: 3 additions & 3 deletions Source/Charts/Utils/ChartUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ extension CGPoint
extension CGContext
{

open func drawImage(_ image: NSUIImage, atCenter center: CGPoint, size: CGSize)
public func drawImage(_ image: NSUIImage, atCenter center: CGPoint, size: CGSize)
{
var drawOffset = CGPoint()
drawOffset.x = center.x - (size.width / 2)
Expand Down Expand Up @@ -157,7 +157,7 @@ extension CGContext
NSUIGraphicsPopContext()
}

open func drawText(_ text: String, at point: CGPoint, align: TextAlignment, anchor: CGPoint = CGPoint(x: 0.5, y: 0.5), angleRadians: CGFloat = 0.0, attributes: [NSAttributedString.Key : Any]?)
public func drawText(_ text: String, at point: CGPoint, align: TextAlignment, anchor: CGPoint = CGPoint(x: 0.5, y: 0.5), angleRadians: CGFloat = 0.0, attributes: [NSAttributedString.Key : Any]?)
{
let drawPoint = getDrawPoint(text: text, point: point, align: align, attributes: attributes)

Expand All @@ -175,7 +175,7 @@ extension CGContext
}
}

open func drawText(_ text: String, at point: CGPoint, anchor: CGPoint = CGPoint(x: 0.5, y: 0.5), angleRadians: CGFloat, attributes: [NSAttributedString.Key : Any]?)
public func drawText(_ text: String, at point: CGPoint, anchor: CGPoint = CGPoint(x: 0.5, y: 0.5), angleRadians: CGFloat, attributes: [NSAttributedString.Key : Any]?)
{
var drawOffset = CGPoint()

Expand Down

0 comments on commit 696c6e5

Please sign in to comment.