Skip to content

Commit

Permalink
Merge pull request #3044 from jjatie/iskind-of
Browse files Browse the repository at this point in the history
Removed `isKind(of:)`
  • Loading branch information
liuxuan30 authored Dec 5, 2017
2 parents 0f74a25 + c7a1c04 commit 19da2c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
19 changes: 8 additions & 11 deletions Source/Charts/Charts/BarLineChartViewBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -913,30 +913,27 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD
open func gestureRecognizer(_ gestureRecognizer: NSUIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: NSUIGestureRecognizer) -> Bool
{
#if !os(tvOS)
if ((gestureRecognizer.isKind(of: NSUIPinchGestureRecognizer.self) &&
otherGestureRecognizer.isKind(of: NSUIPanGestureRecognizer.self)) ||
(gestureRecognizer.isKind(of: NSUIPanGestureRecognizer.self) &&
otherGestureRecognizer.isKind(of: NSUIPinchGestureRecognizer.self)))
if ((gestureRecognizer is NSUIPinchGestureRecognizer && otherGestureRecognizer is NSUIPanGestureRecognizer) ||
(gestureRecognizer is NSUIPanGestureRecognizer && otherGestureRecognizer is NSUIPinchGestureRecognizer))
{
return true
}
#endif

if (gestureRecognizer.isKind(of: NSUIPanGestureRecognizer.self) &&
otherGestureRecognizer.isKind(of: NSUIPanGestureRecognizer.self) && (
gestureRecognizer == _panGestureRecognizer
))
if gestureRecognizer is NSUIPanGestureRecognizer,
otherGestureRecognizer is NSUIPanGestureRecognizer,
gestureRecognizer == _panGestureRecognizer
{
var scrollView = self.superview
while !(scrollView?.isKind(of: NSUIScrollView.self) ?? true)
while !(scrollView is NSUIScrollView)
{
scrollView = scrollView?.superview
}

// If there is two scrollview together, we pick the superview of the inner scrollview.
// In the case of UITableViewWrepperView, the superview will be UITableView
if let superViewOfScrollView = scrollView?.superview
, superViewOfScrollView.isKind(of: NSUIScrollView.self)
if let superViewOfScrollView = scrollView?.superview,
superViewOfScrollView is NSUIScrollView
{
scrollView = superViewOfScrollView
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Charts/Charts/PieRadarChartViewBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ open class PieRadarChartViewBase: ChartViewBase

var minOffset = self.minOffset

if (self.isKind(of: RadarChartView.self))
if self is RadarChartView
{
let x = self.xAxis

Expand Down

0 comments on commit 19da2c0

Please sign in to comment.