Skip to content

Commit c43b6b6

Browse files
authored
Merge pull request #3522 from jlcanale/Swift-4.2
Changes for Swift 4.2, Xcode 10 and iOS 12
2 parents 4fca1f7 + ed67b78 commit c43b6b6

29 files changed

+86
-86
lines changed

Charts.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@
10071007
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator";
10081008
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
10091009
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1010-
SWIFT_VERSION = 4.0;
1010+
SWIFT_VERSION = 4.2;
10111011
TVOS_DEPLOYMENT_TARGET = 9.0;
10121012
VERSIONING_SYSTEM = "apple-generic";
10131013
VERSION_INFO_PREFIX = "";
@@ -1180,7 +1180,7 @@
11801180
SKIP_INSTALL = YES;
11811181
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator";
11821182
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
1183-
SWIFT_VERSION = 4.0;
1183+
SWIFT_VERSION = 4.2;
11841184
TVOS_DEPLOYMENT_TARGET = 9.0;
11851185
VERSIONING_SYSTEM = "apple-generic";
11861186
VERSION_INFO_PREFIX = "";

ChartsDemo-iOS/Objective-C/Components/BalloonMarker.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ open class BalloonMarker: MarkerImage
2525
fileprivate var label: String?
2626
fileprivate var _labelSize: CGSize = CGSize()
2727
fileprivate var _paragraphStyle: NSMutableParagraphStyle?
28-
fileprivate var _drawAttributes = [NSAttributedStringKey : AnyObject]()
28+
fileprivate var _drawAttributes = [NSAttributedString.Key : AnyObject]()
2929

3030
@objc public init(color: UIColor, font: UIFont, textColor: UIColor, insets: UIEdgeInsets)
3131
{

ChartsDemo-iOS/Swift/Components/BalloonMarker.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ open class BalloonMarker: MarkerImage
2424
fileprivate var label: String?
2525
fileprivate var _labelSize: CGSize = CGSize()
2626
fileprivate var _paragraphStyle: NSMutableParagraphStyle?
27-
fileprivate var _drawAttributes = [NSAttributedStringKey : AnyObject]()
27+
fileprivate var _drawAttributes = [NSAttributedString.Key : AnyObject]()
2828

2929
public init(color: UIColor, font: UIFont, textColor: UIColor, insets: UIEdgeInsets)
3030
{

ChartsDemo-macOS/ChartsDemo-macOS/Demos/PieDemoViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ open class PieDemoViewController: NSViewController
3636
paragraphStyle.lineBreakMode = .byTruncatingTail
3737
paragraphStyle.alignment = .center
3838
let centerText: NSMutableAttributedString = NSMutableAttributedString(string: "Charts\nby Daniel Cohen Gindi")
39-
centerText.setAttributes([NSAttributedStringKey.font: NSFont(name: "HelveticaNeue-Light", size: 15.0)!, NSAttributedStringKey.paragraphStyle: paragraphStyle], range: NSMakeRange(0, centerText.length))
40-
centerText.addAttributes([NSAttributedStringKey.font: NSFont(name: "HelveticaNeue-Light", size: 13.0)!, NSAttributedStringKey.foregroundColor: NSColor.gray], range: NSMakeRange(10, centerText.length - 10))
41-
centerText.addAttributes([NSAttributedStringKey.font: NSFont(name: "HelveticaNeue-LightItalic", size: 13.0)!, NSAttributedStringKey.foregroundColor: NSColor(red: 51 / 255.0, green: 181 / 255.0, blue: 229 / 255.0, alpha: 1.0)], range: NSMakeRange(centerText.length - 19, 19))
39+
centerText.setAttributes([NSAttributedString.Key.font: NSFont(name: "HelveticaNeue-Light", size: 15.0)!, NSAttributedString.Key.paragraphStyle: paragraphStyle], range: NSMakeRange(0, centerText.length))
40+
centerText.addAttributes([NSAttributedString.Key.font: NSFont(name: "HelveticaNeue-Light", size: 13.0)!, NSAttributedString.Key.foregroundColor: NSColor.gray], range: NSMakeRange(10, centerText.length - 10))
41+
centerText.addAttributes([NSAttributedString.Key.font: NSFont(name: "HelveticaNeue-LightItalic", size: 13.0)!, NSAttributedString.Key.foregroundColor: NSColor(red: 51 / 255.0, green: 181 / 255.0, blue: 229 / 255.0, alpha: 1.0)], range: NSMakeRange(centerText.length - 19, 19))
4242

4343
self.pieChartView.centerAttributedText = centerText
4444

Source/Charts/Animation/Animator.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ open class Animator: NSObject
7070
{
7171
guard _displayLink != nil else { return }
7272

73-
_displayLink?.remove(from: .main, forMode: .commonModes)
73+
_displayLink?.remove(from: .main, forMode: RunLoop.Mode.common)
7474
_displayLink = nil
7575

7676
_enabledX = false
@@ -163,7 +163,7 @@ open class Animator: NSObject
163163
if _enabledX || _enabledY
164164
{
165165
_displayLink = NSUIDisplayLink(target: self, selector: #selector(animationLoop))
166-
_displayLink?.add(to: RunLoop.main, forMode: RunLoopMode.commonModes)
166+
_displayLink?.add(to: RunLoop.main, forMode: RunLoop.Mode.common)
167167
}
168168
}
169169

@@ -219,7 +219,7 @@ open class Animator: NSObject
219219
_displayLink == nil
220220
{
221221
_displayLink = NSUIDisplayLink(target: self, selector: #selector(animationLoop))
222-
_displayLink?.add(to: .main, forMode: .commonModes)
222+
_displayLink?.add(to: .main, forMode: RunLoop.Mode.common)
223223
}
224224
}
225225

@@ -253,7 +253,7 @@ open class Animator: NSObject
253253
_displayLink == nil
254254
{
255255
_displayLink = NSUIDisplayLink(target: self, selector: #selector(animationLoop))
256-
_displayLink?.add(to: .main, forMode: .commonModes)
256+
_displayLink?.add(to: .main, forMode: RunLoop.Mode.common)
257257
}
258258
}
259259

Source/Charts/Charts/BarLineChartViewBase.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD
775775
_decelerationVelocity = recognizer.velocity(in: self)
776776

777777
_decelerationDisplayLink = NSUIDisplayLink(target: self, selector: #selector(BarLineChartViewBase.decelerationLoop))
778-
_decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoopMode.commonModes)
778+
_decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoop.Mode.common)
779779
}
780780

781781
_isDragging = false
@@ -832,7 +832,7 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD
832832
{
833833
if _decelerationDisplayLink !== nil
834834
{
835-
_decelerationDisplayLink.remove(from: RunLoop.main, forMode: RunLoopMode.commonModes)
835+
_decelerationDisplayLink.remove(from: RunLoop.main, forMode: RunLoop.Mode.common)
836836
_decelerationDisplayLink = nil
837837
}
838838
}

Source/Charts/Charts/ChartViewBase.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,10 @@ open class ChartViewBase: NSUIView, ChartDataProvider, AnimatorDelegate
354354
let position = description.position ?? CGPoint(x: bounds.width - _viewPortHandler.offsetRight - description.xOffset,
355355
y: bounds.height - _viewPortHandler.offsetBottom - description.yOffset - description.font.lineHeight)
356356

357-
var attrs = [NSAttributedStringKey : Any]()
357+
var attrs = [NSAttributedString.Key : Any]()
358358

359-
attrs[NSAttributedStringKey.font] = description.font
360-
attrs[NSAttributedStringKey.foregroundColor] = description.textColor
359+
attrs[NSAttributedString.Key.font] = description.font
360+
attrs[NSAttributedString.Key.foregroundColor] = description.textColor
361361

362362
ChartUtils.drawText(
363363
context: context,

Source/Charts/Charts/PieChartView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,9 @@ open class PieChartView: PieRadarChartViewBase
398398

399399
attrString = NSMutableAttributedString(string: newValue!)
400400
attrString?.setAttributes([
401-
NSAttributedStringKey.foregroundColor: NSUIColor.black,
402-
NSAttributedStringKey.font: NSUIFont.systemFont(ofSize: 12.0),
403-
NSAttributedStringKey.paragraphStyle: paragraphStyle
401+
NSAttributedString.Key.foregroundColor: NSUIColor.black,
402+
NSAttributedString.Key.font: NSUIFont.systemFont(ofSize: 12.0),
403+
NSAttributedString.Key.paragraphStyle: paragraphStyle
404404
], range: NSMakeRange(0, attrString!.length))
405405
}
406406
self.centerAttributedText = attrString

Source/Charts/Charts/PieRadarChartViewBase.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ open class PieRadarChartViewBase: ChartViewBase
532532
{
533533
_decelerationLastTime = CACurrentMediaTime()
534534
_decelerationDisplayLink = NSUIDisplayLink(target: self, selector: #selector(PieRadarChartViewBase.decelerationLoop))
535-
_decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoopMode.commonModes)
535+
_decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoop.Mode.common)
536536
}
537537
}
538538
}
@@ -768,7 +768,7 @@ open class PieRadarChartViewBase: ChartViewBase
768768
{
769769
if _decelerationDisplayLink !== nil
770770
{
771-
_decelerationDisplayLink.remove(from: RunLoop.main, forMode: RunLoopMode.commonModes)
771+
_decelerationDisplayLink.remove(from: RunLoop.main, forMode: RunLoop.Mode.common)
772772
_decelerationDisplayLink = nil
773773
}
774774
}
@@ -857,7 +857,7 @@ open class PieRadarChartViewBase: ChartViewBase
857857
{
858858
_decelerationLastTime = CACurrentMediaTime()
859859
_decelerationDisplayLink = NSUIDisplayLink(target: self, selector: #selector(PieRadarChartViewBase.decelerationLoop))
860-
_decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoopMode.commonModes)
860+
_decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoop.Mode.common)
861861
}
862862
}
863863
}

Source/Charts/Components/Legend.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ open class Legend: ComponentBase
315315

316316
// Start calculating layout
317317

318-
let labelAttrs = [NSAttributedStringKey.font: labelFont]
318+
let labelAttrs = [NSAttributedString.Key.font: labelFont]
319319
var maxLineWidth: CGFloat = 0.0
320320
var currentLineWidth: CGFloat = 0.0
321321
var requiredWidth: CGFloat = 0.0

0 commit comments

Comments
 (0)