Skip to content

Commit

Permalink
Merge pull request #1258 from puthirith/Swift-3.0
Browse files Browse the repository at this point in the history
Fix Swift 3 compilation errors for iOS
  • Loading branch information
liuxuan30 authored Jul 25, 2016
2 parents b713620 + 0b65705 commit 30edf8e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions Charts/Classes/Animation/ChartAnimator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public class ChartAnimator: NSObject
{
if (_displayLink != nil)
{
_displayLink.remove(from: RunLoop.main(), forMode: RunLoopMode.commonModes.rawValue)
_displayLink.remove(from: RunLoop.main, forMode: RunLoopMode(rawValue: RunLoopMode.commonModes.rawValue))
_displayLink = nil

_enabledX = false
Expand Down Expand Up @@ -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.commonModes.rawValue)
_displayLink.add(to: RunLoop.main, forMode: RunLoopMode(rawValue: RunLoopMode.commonModes.rawValue))
}
}

Expand Down Expand Up @@ -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.commonModes.rawValue)
_displayLink.add(to: RunLoop.main, forMode: RunLoopMode(rawValue: RunLoopMode.commonModes.rawValue))
}
}
}
Expand Down Expand Up @@ -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.commonModes.rawValue)
_displayLink.add(to: RunLoop.main, forMode: RunLoopMode(rawValue: RunLoopMode.commonModes.rawValue))
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions Charts/Classes/Charts/BarLineChartViewBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.commonModes.rawValue)
_decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoopMode(rawValue: RunLoopMode.commonModes.rawValue))
}

_isDragging = false
Expand Down Expand Up @@ -875,7 +875,7 @@ public class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChar
{
if (_decelerationDisplayLink !== nil)
{
_decelerationDisplayLink.remove(from: RunLoop.main(), forMode: RunLoopMode.commonModes.rawValue)
_decelerationDisplayLink.remove(from: RunLoop.main, forMode: RunLoopMode(rawValue: RunLoopMode.commonModes.rawValue))
_decelerationDisplayLink = nil
}
}
Expand Down Expand Up @@ -1439,7 +1439,7 @@ public class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChar
{
_customViewPortEnabled = true

if (Thread.isMainThread())
if (Thread.isMainThread)
{
self._viewPortHandler.restrainViewPort(offsetLeft: left, offsetTop: top, offsetRight: right, offsetBottom: bottom)
prepareOffsetMatrix()
Expand Down
6 changes: 3 additions & 3 deletions Charts/Classes/Charts/PieRadarChartViewBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.commonModes.rawValue)
_decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoopMode(rawValue: RunLoopMode.commonModes.rawValue))
}
}
}
Expand Down Expand Up @@ -788,7 +788,7 @@ public class PieRadarChartViewBase: ChartViewBase
{
if (_decelerationDisplayLink !== nil)
{
_decelerationDisplayLink.remove(from: RunLoop.main(), forMode: RunLoopMode.commonModes.rawValue)
_decelerationDisplayLink.remove(from: RunLoop.main, forMode: RunLoopMode(rawValue: RunLoopMode.commonModes.rawValue))
_decelerationDisplayLink = nil
}
}
Expand Down Expand Up @@ -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.commonModes.rawValue)
_decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoopMode(rawValue: RunLoopMode.commonModes.rawValue))
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Charts/Classes/Jobs/AnimatedViewPortJob.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.commonModes.rawValue)
_displayLink.add(to: RunLoop.main, forMode: RunLoopMode(rawValue: RunLoopMode.commonModes.rawValue))
}

public func stop(finish: Bool)
{
if (_displayLink != nil)
{
_displayLink.remove(from: RunLoop.main(), forMode: RunLoopMode.commonModes.rawValue)
_displayLink.remove(from: RunLoop.main, forMode: RunLoopMode(rawValue: RunLoopMode.commonModes.rawValue))
_displayLink = nil

if finish
Expand Down

0 comments on commit 30edf8e

Please sign in to comment.