diff --git a/Charts/Classes/Animation/Animator.swift b/Charts/Classes/Animation/Animator.swift index 6b07720df0..d671d6c0e2 100644 --- a/Charts/Classes/Animation/Animator.swift +++ b/Charts/Classes/Animation/Animator.swift @@ -194,7 +194,7 @@ public class Animator: NSObject if (_enabledX || _enabledY) { - _displayLink = NSUIDisplayLink(target: self, selector: #selector(Animator.animationLoop)) + _displayLink = NSUIDisplayLink(target: self, selector: #selector(animationLoop)) _displayLink.addToRunLoop(NSRunLoop.mainRunLoop(), forMode: NSRunLoopCommonModes) } } @@ -260,7 +260,7 @@ public class Animator: NSObject { if _displayLink === nil { - _displayLink = NSUIDisplayLink(target: self, selector: #selector(Animator.animationLoop)) + _displayLink = NSUIDisplayLink(target: self, selector: #selector(animationLoop)) _displayLink.addToRunLoop(NSRunLoop.mainRunLoop(), forMode: NSRunLoopCommonModes) } } @@ -304,7 +304,7 @@ public class Animator: NSObject { if _displayLink === nil { - _displayLink = NSUIDisplayLink(target: self, selector: #selector(Animator.animationLoop)) + _displayLink = NSUIDisplayLink(target: self, selector: #selector(animationLoop)) _displayLink.addToRunLoop(NSRunLoop.mainRunLoop(), forMode: NSRunLoopCommonModes) } } diff --git a/Charts/Classes/Charts/BarLineChartViewBase.swift b/Charts/Classes/Charts/BarLineChartViewBase.swift index 4a15d0dc8c..06ff28a504 100644 --- a/Charts/Classes/Charts/BarLineChartViewBase.swift +++ b/Charts/Classes/Charts/BarLineChartViewBase.swift @@ -108,10 +108,10 @@ public class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChar self.highlighter = ChartHighlighter(chart: self) - _tapGestureRecognizer = NSUITapGestureRecognizer(target: self, action: #selector(BarLineChartViewBase.tapGestureRecognized(_:))) - _doubleTapGestureRecognizer = NSUITapGestureRecognizer(target: self, action: #selector(BarLineChartViewBase.doubleTapGestureRecognized(_:))) + _tapGestureRecognizer = NSUITapGestureRecognizer(target: self, action: #selector(tapGestureRecognized(_:))) + _doubleTapGestureRecognizer = NSUITapGestureRecognizer(target: self, action: #selector(doubleTapGestureRecognized(_:))) _doubleTapGestureRecognizer.nsuiNumberOfTapsRequired = 2 - _panGestureRecognizer = NSUIPanGestureRecognizer(target: self, action: #selector(BarLineChartViewBase.panGestureRecognized(_:))) + _panGestureRecognizer = NSUIPanGestureRecognizer(target: self, action: #selector(panGestureRecognized(_:))) _panGestureRecognizer.delegate = self diff --git a/Charts/Classes/Charts/PieRadarChartViewBase.swift b/Charts/Classes/Charts/PieRadarChartViewBase.swift index 2c5197abf2..6be1ab9e51 100755 --- a/Charts/Classes/Charts/PieRadarChartViewBase.swift +++ b/Charts/Classes/Charts/PieRadarChartViewBase.swift @@ -58,12 +58,12 @@ public class PieRadarChartViewBase: ChartViewBase { super.initialize() - _tapGestureRecognizer = NSUITapGestureRecognizer(target: self, action: #selector(PieRadarChartViewBase.tapGestureRecognized(_:))) + _tapGestureRecognizer = NSUITapGestureRecognizer(target: self, action: #selector(tapGestureRecognized(_:))) self.addGestureRecognizer(_tapGestureRecognizer) #if !os(tvOS) - _rotationGestureRecognizer = NSUIRotationGestureRecognizer(target: self, action: #selector(PieRadarChartViewBase.rotationGestureRecognized(_:))) + _rotationGestureRecognizer = NSUIRotationGestureRecognizer(target: self, action: #selector(rotationGestureRecognized(_:))) self.addGestureRecognizer(_rotationGestureRecognizer) _rotationGestureRecognizer.enabled = rotationWithTwoFingers #endif diff --git a/Charts/Classes/Jobs/AnimatedViewPortJob.swift b/Charts/Classes/Jobs/AnimatedViewPortJob.swift index 717da4f147..b86854783d 100644 --- a/Charts/Classes/Jobs/AnimatedViewPortJob.swift +++ b/Charts/Classes/Jobs/AnimatedViewPortJob.swift @@ -70,7 +70,7 @@ public class AnimatedViewPortJob: ViewPortJob updateAnimationPhase(_startTime) - _displayLink = NSUIDisplayLink(target: self, selector: #selector(AnimatedViewPortJob.animationLoop)) + _displayLink = NSUIDisplayLink(target: self, selector: #selector(animationLoop)) _displayLink.addToRunLoop(NSRunLoop.mainRunLoop(), forMode: NSRunLoopCommonModes) } diff --git a/Charts/Classes/Utils/ViewPortHandler.swift b/Charts/Classes/Utils/ViewPortHandler.swift index c3346ebd8a..63ec52c5fd 100755 --- a/Charts/Classes/Utils/ViewPortHandler.swift +++ b/Charts/Classes/Utils/ViewPortHandler.swift @@ -407,60 +407,39 @@ public class ViewPortHandler: NSObject public func isInBoundsX(x: CGFloat) -> Bool { - if (isInBoundsLeft(x) && isInBoundsRight(x)) - { - return true - } - else - { - return false - } + return isInBoundsLeft(x) && isInBoundsRight(x) } public func isInBoundsY(y: CGFloat) -> Bool { - if (isInBoundsTop(y) && isInBoundsBottom(y)) - { - return true - } - else - { - return false - } + return isInBoundsTop(y) && isInBoundsBottom(y) } public func isInBounds(x x: CGFloat, y: CGFloat) -> Bool { - if (isInBoundsX(x) && isInBoundsY(y)) - { - return true - } - else - { - return false - } + return isInBoundsX(x) && isInBoundsY(y) } public func isInBoundsLeft(x: CGFloat) -> Bool { - return _contentRect.origin.x <= x + 1.0 ? true : false + return _contentRect.origin.x <= x + 1.0 } public func isInBoundsRight(x: CGFloat) -> Bool { let x = floor(x * 100.0) / 100.0 - return (_contentRect.origin.x + _contentRect.size.width) >= x - 1.0 ? true : false + return (_contentRect.origin.x + _contentRect.size.width) >= x - 1.0 } public func isInBoundsTop(y: CGFloat) -> Bool { - return _contentRect.origin.y <= y ? true : false + return _contentRect.origin.y <= y } public func isInBoundsBottom(y: CGFloat) -> Bool { let normalizedY = floor(y * 100.0) / 100.0 - return (_contentRect.origin.y + _contentRect.size.height) >= normalizedY ? true : false + return (_contentRect.origin.y + _contentRect.size.height) >= normalizedY } /// - returns: The current x-scale factor @@ -514,40 +493,19 @@ public class ViewPortHandler: NSObject /// if the chart is fully zoomed out, return true public var isFullyZoomedOut: Bool { - if (isFullyZoomedOutX && isFullyZoomedOutY) - { - return true - } - else - { - return false - } + return isFullyZoomedOutX && isFullyZoomedOutY } /// - returns: `true` if the chart is fully zoomed out on it's y-axis (vertical). public var isFullyZoomedOutY: Bool { - if (_scaleY > _minScaleY || _minScaleY > 1.0) - { - return false - } - else - { - return true - } + return _scaleY > _minScaleY || _minScaleY > 1.0 } /// - returns: `true` if the chart is fully zoomed out on it's x-axis (horizontal). public var isFullyZoomedOutX: Bool { - if (_scaleX > _minScaleX || _minScaleX > 1.0) - { - return false - } - else - { - return true - } + return _scaleX > _minScaleX || _minScaleX > 1.0 } /// Set an offset in pixels that allows the user to drag the chart over it's bounds on the x-axis. @@ -571,24 +529,24 @@ public class ViewPortHandler: NSObject /// - returns: `true` if the chart is not yet fully zoomed out on the x-axis public var canZoomOutMoreX: Bool { - return (_scaleX > _minScaleX) + return _scaleX > _minScaleX } /// - returns: `true` if the chart is not yet fully zoomed in on the x-axis public var canZoomInMoreX: Bool { - return (_scaleX < _maxScaleX) + return _scaleX < _maxScaleX } /// - returns: `true` if the chart is not yet fully zoomed out on the y-axis public var canZoomOutMoreY: Bool { - return (_scaleY > _minScaleY) + return _scaleY > _minScaleY } /// - returns: `true` if the chart is not yet fully zoomed in on the y-axis public var canZoomInMoreY: Bool { - return (_scaleY < _maxScaleY) + return _scaleY < _maxScaleY } }