From 55c79316160b028f06ebf8b18bcaa008f996f157 Mon Sep 17 00:00:00 2001 From: liuxuan30 Date: Sat, 6 Aug 2016 10:29:37 +0800 Subject: [PATCH] convert RunLoopMode to swift 3.0 syntax --- Charts/Classes/Animation/ChartAnimator.swift | 8 ++++---- Charts/Classes/Charts/BarLineChartViewBase.swift | 4 ++-- Charts/Classes/Charts/PieRadarChartViewBase.swift | 6 +++--- Charts/Classes/Jobs/AnimatedViewPortJob.swift | 4 ++-- Charts/Classes/Utils/ChartPlatform.swift | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Charts/Classes/Animation/ChartAnimator.swift b/Charts/Classes/Animation/ChartAnimator.swift index ebb08a141d..f4ff32f7ff 100644 --- a/Charts/Classes/Animation/ChartAnimator.swift +++ b/Charts/Classes/Animation/ChartAnimator.swift @@ -71,7 +71,7 @@ public class ChartAnimator: NSObject { if (_displayLink != nil) { - _displayLink.remove(from: RunLoop.main, forMode: RunLoopMode(rawValue: RunLoopMode.commonModes.rawValue)) + _displayLink.remove(from: RunLoop.main, forMode: RunLoopMode.commonModes) _displayLink = nil _enabledX = false @@ -196,7 +196,7 @@ public class ChartAnimator: NSObject if (_enabledX || _enabledY) { _displayLink = NSUIDisplayLink(target: self, selector: #selector(ChartAnimator.animationLoop)) - _displayLink.add(to: RunLoop.main, forMode: RunLoopMode(rawValue: RunLoopMode.commonModes.rawValue)) + _displayLink.add(to: RunLoop.main, forMode: RunLoopMode.commonModes) } } @@ -262,7 +262,7 @@ public class ChartAnimator: NSObject if _displayLink === nil { _displayLink = NSUIDisplayLink(target: self, selector: #selector(ChartAnimator.animationLoop)) - _displayLink.add(to: RunLoop.main, forMode: RunLoopMode(rawValue: RunLoopMode.commonModes.rawValue)) + _displayLink.add(to: RunLoop.main, forMode: RunLoopMode.commonModes) } } } @@ -306,7 +306,7 @@ public class ChartAnimator: NSObject if _displayLink === nil { _displayLink = NSUIDisplayLink(target: self, selector: #selector(ChartAnimator.animationLoop)) - _displayLink.add(to: RunLoop.main, forMode: RunLoopMode(rawValue: RunLoopMode.commonModes.rawValue)) + _displayLink.add(to: RunLoop.main, forMode: RunLoopMode.commonModes) } } } diff --git a/Charts/Classes/Charts/BarLineChartViewBase.swift b/Charts/Classes/Charts/BarLineChartViewBase.swift index 1852e81116..89f6369c11 100644 --- a/Charts/Classes/Charts/BarLineChartViewBase.swift +++ b/Charts/Classes/Charts/BarLineChartViewBase.swift @@ -824,7 +824,7 @@ public class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChar _decelerationVelocity = recognizer.velocity(in: self) _decelerationDisplayLink = NSUIDisplayLink(target: self, selector: #selector(BarLineChartViewBase.decelerationLoop)) - _decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoopMode(rawValue: RunLoopMode.commonModes.rawValue)) + _decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoopMode.commonModes) } _isDragging = false @@ -875,7 +875,7 @@ public class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChar { if (_decelerationDisplayLink !== nil) { - _decelerationDisplayLink.remove(from: RunLoop.main, forMode: RunLoopMode(rawValue: RunLoopMode.commonModes.rawValue)) + _decelerationDisplayLink.remove(from: RunLoop.main, forMode: RunLoopMode.commonModes) _decelerationDisplayLink = nil } } diff --git a/Charts/Classes/Charts/PieRadarChartViewBase.swift b/Charts/Classes/Charts/PieRadarChartViewBase.swift index 39a42bb153..f332040614 100755 --- a/Charts/Classes/Charts/PieRadarChartViewBase.swift +++ b/Charts/Classes/Charts/PieRadarChartViewBase.swift @@ -543,7 +543,7 @@ public class PieRadarChartViewBase: ChartViewBase { _decelerationLastTime = CACurrentMediaTime() _decelerationDisplayLink = NSUIDisplayLink(target: self, selector: #selector(PieRadarChartViewBase.decelerationLoop)) - _decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoopMode(rawValue: RunLoopMode.commonModes.rawValue)) + _decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoopMode.commonModes) } } } @@ -788,7 +788,7 @@ public class PieRadarChartViewBase: ChartViewBase { if (_decelerationDisplayLink !== nil) { - _decelerationDisplayLink.remove(from: RunLoop.main, forMode: RunLoopMode(rawValue: RunLoopMode.commonModes.rawValue)) + _decelerationDisplayLink.remove(from: RunLoop.main, forMode: RunLoopMode.commonModes) _decelerationDisplayLink = nil } } @@ -944,7 +944,7 @@ public class PieRadarChartViewBase: ChartViewBase { _decelerationLastTime = CACurrentMediaTime() _decelerationDisplayLink = NSUIDisplayLink(target: self, selector: #selector(PieRadarChartViewBase.decelerationLoop)) - _decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoopMode(rawValue: RunLoopMode.commonModes.rawValue)) + _decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoopMode.commonModes) } } } diff --git a/Charts/Classes/Jobs/AnimatedViewPortJob.swift b/Charts/Classes/Jobs/AnimatedViewPortJob.swift index d3e462d510..5c72688299 100644 --- a/Charts/Classes/Jobs/AnimatedViewPortJob.swift +++ b/Charts/Classes/Jobs/AnimatedViewPortJob.swift @@ -71,14 +71,14 @@ public class AnimatedViewPortJob: ChartViewPortJob updateAnimationPhase(_startTime) _displayLink = NSUIDisplayLink(target: self, selector: #selector(AnimatedViewPortJob.animationLoop)) - _displayLink.add(to: RunLoop.main, forMode: RunLoopMode(rawValue: RunLoopMode.commonModes.rawValue)) + _displayLink.add(to: RunLoop.main, forMode: RunLoopMode.commonModes) } public func stop(finish: Bool) { if (_displayLink != nil) { - _displayLink.remove(from: RunLoop.main, forMode: RunLoopMode(rawValue: RunLoopMode.commonModes.rawValue)) + _displayLink.remove(from: RunLoop.main, forMode: RunLoopMode.commonModes) _displayLink = nil if finish diff --git a/Charts/Classes/Utils/ChartPlatform.swift b/Charts/Classes/Utils/ChartPlatform.swift index 6a24af007c..7785e1375c 100644 --- a/Charts/Classes/Utils/ChartPlatform.swift +++ b/Charts/Classes/Utils/ChartPlatform.swift @@ -264,7 +264,7 @@ types are aliased to either their UI* implementation (on iOS) or their NS* imple stop() } - public func add(to runloop: RunLoop, forMode: String) + public func add(to runloop: RunLoop, forMode: RunLoopMode) { if displayLink != nil { @@ -272,11 +272,11 @@ types are aliased to either their UI* implementation (on iOS) or their NS* imple } else if timer != nil { - runloop.add(timer!, forMode: RunLoopMode(rawValue: forMode)) + runloop.add(timer!, forMode: forMode) } } - public func remove(from runloop: RunLoop, forMode: String) + public func remove(from runloop: RunLoop, forMode: RunLoopMode) { stop() }