From c91dff4ad508ae567da227a5ef18eaf28fe0abcc Mon Sep 17 00:00:00 2001 From: Jake MacMullin Date: Tue, 21 Jul 2015 14:13:38 +1000 Subject: [PATCH 1/2] Fixes to allow the code to compile with Swift 2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Failable initializers can’t override non-failable initializers - observeValueForKeyPath’s signature didn’t match the signature of the method it was overriding --- Charts/Classes/Charts/BarLineChartViewBase.swift | 2 +- Charts/Classes/Charts/ChartViewBase.swift | 5 ++--- Charts/Classes/Charts/PieChartView.swift | 2 +- Charts/Classes/Charts/PieRadarChartViewBase.swift | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Charts/Classes/Charts/BarLineChartViewBase.swift b/Charts/Classes/Charts/BarLineChartViewBase.swift index 6b60920257..dc592ceb59 100644 --- a/Charts/Classes/Charts/BarLineChartViewBase.swift +++ b/Charts/Classes/Charts/BarLineChartViewBase.swift @@ -74,7 +74,7 @@ public class BarLineChartViewBase: ChartViewBase, UIGestureRecognizerDelegate super.init(frame: frame) } - public required init?(coder aDecoder: NSCoder) + public required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } diff --git a/Charts/Classes/Charts/ChartViewBase.swift b/Charts/Classes/Charts/ChartViewBase.swift index 841f7d5d60..f886c97f9c 100755 --- a/Charts/Classes/Charts/ChartViewBase.swift +++ b/Charts/Classes/Charts/ChartViewBase.swift @@ -143,7 +143,7 @@ public class ChartViewBase: UIView, ChartAnimatorDelegate initialize() } - public required init?(coder aDecoder: NSCoder) + public required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder) initialize() @@ -828,8 +828,7 @@ public class ChartViewBase: UIView, ChartAnimatorDelegate internal typealias VoidClosureType = () -> () internal var _sizeChangeEventActions = [VoidClosureType]() - override public func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String: AnyObject]?, context: UnsafeMutablePointer) - { + public override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [NSObject : AnyObject]?, context: UnsafeMutablePointer) { if (keyPath == "bounds" || keyPath == "frame") { let bounds = self.bounds diff --git a/Charts/Classes/Charts/PieChartView.swift b/Charts/Classes/Charts/PieChartView.swift index f11aa1dac9..502d5a9cec 100755 --- a/Charts/Classes/Charts/PieChartView.swift +++ b/Charts/Classes/Charts/PieChartView.swift @@ -31,7 +31,7 @@ public class PieChartView: PieRadarChartViewBase super.init(frame: frame) } - public required init?(coder aDecoder: NSCoder) + public required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } diff --git a/Charts/Classes/Charts/PieRadarChartViewBase.swift b/Charts/Classes/Charts/PieRadarChartViewBase.swift index aaba8de186..826ae5827f 100755 --- a/Charts/Classes/Charts/PieRadarChartViewBase.swift +++ b/Charts/Classes/Charts/PieRadarChartViewBase.swift @@ -37,7 +37,7 @@ public class PieRadarChartViewBase: ChartViewBase super.init(frame: frame) } - public required init?(coder aDecoder: NSCoder) + public required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } From 0f0bdf6635a5d31a21074baf834722e71d46d255 Mon Sep 17 00:00:00 2001 From: Jake MacMullin Date: Tue, 21 Jul 2015 18:57:20 +1000 Subject: [PATCH 2/2] Respecting the style of the framework (and I missed on failable initializer) --- Charts/Classes/Charts/ChartViewBase.swift | 3 ++- Charts/Classes/Charts/RadarChartView.swift | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Charts/Classes/Charts/ChartViewBase.swift b/Charts/Classes/Charts/ChartViewBase.swift index f886c97f9c..c144dedca9 100755 --- a/Charts/Classes/Charts/ChartViewBase.swift +++ b/Charts/Classes/Charts/ChartViewBase.swift @@ -828,7 +828,8 @@ public class ChartViewBase: UIView, ChartAnimatorDelegate internal typealias VoidClosureType = () -> () internal var _sizeChangeEventActions = [VoidClosureType]() - public override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [NSObject : AnyObject]?, context: UnsafeMutablePointer) { + public override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [NSObject : AnyObject]?, context: UnsafeMutablePointer) + { if (keyPath == "bounds" || keyPath == "frame") { let bounds = self.bounds diff --git a/Charts/Classes/Charts/RadarChartView.swift b/Charts/Classes/Charts/RadarChartView.swift index bbcc0f1d9c..31ddfb6dac 100644 --- a/Charts/Classes/Charts/RadarChartView.swift +++ b/Charts/Classes/Charts/RadarChartView.swift @@ -51,7 +51,7 @@ public class RadarChartView: PieRadarChartViewBase super.init(frame: frame) } - public required init?(coder aDecoder: NSCoder) + public required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder) }