瀏覽代碼

Merge pull request #3522 from jlcanale/Swift-4.2

Changes for Swift 4.2, Xcode 10 and iOS 12
Pierre-Marc Airoldi 7 年之前
父節點
當前提交
c43b6b6070
共有 29 個文件被更改,包括 86 次插入86 次删除
  1. 2 2
      Charts.xcodeproj/project.pbxproj
  2. 1 1
      ChartsDemo-iOS/Objective-C/Components/BalloonMarker.swift
  3. 1 1
      ChartsDemo-iOS/Swift/Components/BalloonMarker.swift
  4. 3 3
      ChartsDemo-macOS/ChartsDemo-macOS/Demos/PieDemoViewController.swift
  5. 4 4
      Source/Charts/Animation/Animator.swift
  6. 2 2
      Source/Charts/Charts/BarLineChartViewBase.swift
  7. 3 3
      Source/Charts/Charts/ChartViewBase.swift
  8. 3 3
      Source/Charts/Charts/PieChartView.swift
  9. 3 3
      Source/Charts/Charts/PieRadarChartViewBase.swift
  10. 1 1
      Source/Charts/Components/Legend.swift
  11. 1 1
      Source/Charts/Components/YAxis.swift
  12. 2 2
      Source/Charts/Jobs/AnimatedViewPortJob.swift
  13. 1 1
      Source/Charts/Renderers/BarChartRenderer.swift
  14. 1 1
      Source/Charts/Renderers/BubbleChartRenderer.swift
  15. 1 1
      Source/Charts/Renderers/CandleStickChartRenderer.swift
  16. 3 3
      Source/Charts/Renderers/HorizontalBarChartRenderer.swift
  17. 1 1
      Source/Charts/Renderers/LegendRenderer.swift
  18. 1 1
      Source/Charts/Renderers/LineChartRenderer.swift
  19. 12 12
      Source/Charts/Renderers/PieChartRenderer.swift
  20. 2 2
      Source/Charts/Renderers/RadarChartRenderer.swift
  21. 1 1
      Source/Charts/Renderers/ScatterChartRenderer.swift
  22. 9 9
      Source/Charts/Renderers/XAxisRenderer.swift
  23. 7 7
      Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift
  24. 2 2
      Source/Charts/Renderers/XAxisRendererRadarChart.swift
  25. 5 5
      Source/Charts/Renderers/YAxisRenderer.swift
  26. 5 5
      Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift
  27. 2 2
      Source/Charts/Renderers/YAxisRendererRadarChart.swift
  28. 4 4
      Source/Charts/Utils/ChartUtils.swift
  29. 3 3
      Source/Charts/Utils/Platform.swift

+ 2 - 2
Charts.xcodeproj/project.pbxproj

@@ -1007,7 +1007,7 @@
 				SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator";
 				SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator";
 				SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
 				SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
 				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
 				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
-				SWIFT_VERSION = 4.0;
+				SWIFT_VERSION = 4.2;
 				TVOS_DEPLOYMENT_TARGET = 9.0;
 				TVOS_DEPLOYMENT_TARGET = 9.0;
 				VERSIONING_SYSTEM = "apple-generic";
 				VERSIONING_SYSTEM = "apple-generic";
 				VERSION_INFO_PREFIX = "";
 				VERSION_INFO_PREFIX = "";
@@ -1180,7 +1180,7 @@
 				SKIP_INSTALL = YES;
 				SKIP_INSTALL = YES;
 				SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator";
 				SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator";
 				SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
 				SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
-				SWIFT_VERSION = 4.0;
+				SWIFT_VERSION = 4.2;
 				TVOS_DEPLOYMENT_TARGET = 9.0;
 				TVOS_DEPLOYMENT_TARGET = 9.0;
 				VERSIONING_SYSTEM = "apple-generic";
 				VERSIONING_SYSTEM = "apple-generic";
 				VERSION_INFO_PREFIX = "";
 				VERSION_INFO_PREFIX = "";

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

@@ -25,7 +25,7 @@ open class BalloonMarker: MarkerImage
     fileprivate var label: String?
     fileprivate var label: String?
     fileprivate var _labelSize: CGSize = CGSize()
     fileprivate var _labelSize: CGSize = CGSize()
     fileprivate var _paragraphStyle: NSMutableParagraphStyle?
     fileprivate var _paragraphStyle: NSMutableParagraphStyle?
-    fileprivate var _drawAttributes = [NSAttributedStringKey : AnyObject]()
+    fileprivate var _drawAttributes = [NSAttributedString.Key : AnyObject]()
     
     
     @objc public init(color: UIColor, font: UIFont, textColor: UIColor, insets: UIEdgeInsets)
     @objc public init(color: UIColor, font: UIFont, textColor: UIColor, insets: UIEdgeInsets)
     {
     {

+ 1 - 1
ChartsDemo-iOS/Swift/Components/BalloonMarker.swift

@@ -24,7 +24,7 @@ open class BalloonMarker: MarkerImage
     fileprivate var label: String?
     fileprivate var label: String?
     fileprivate var _labelSize: CGSize = CGSize()
     fileprivate var _labelSize: CGSize = CGSize()
     fileprivate var _paragraphStyle: NSMutableParagraphStyle?
     fileprivate var _paragraphStyle: NSMutableParagraphStyle?
-    fileprivate var _drawAttributes = [NSAttributedStringKey : AnyObject]()
+    fileprivate var _drawAttributes = [NSAttributedString.Key : AnyObject]()
     
     
     public init(color: UIColor, font: UIFont, textColor: UIColor, insets: UIEdgeInsets)
     public init(color: UIColor, font: UIFont, textColor: UIColor, insets: UIEdgeInsets)
     {
     {

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

@@ -36,9 +36,9 @@ open class PieDemoViewController: NSViewController
         paragraphStyle.lineBreakMode = .byTruncatingTail
         paragraphStyle.lineBreakMode = .byTruncatingTail
         paragraphStyle.alignment = .center
         paragraphStyle.alignment = .center
         let centerText: NSMutableAttributedString = NSMutableAttributedString(string: "Charts\nby Daniel Cohen Gindi")
         let centerText: NSMutableAttributedString = NSMutableAttributedString(string: "Charts\nby Daniel Cohen Gindi")
-        centerText.setAttributes([NSAttributedStringKey.font: NSFont(name: "HelveticaNeue-Light", size: 15.0)!, NSAttributedStringKey.paragraphStyle: paragraphStyle], range: NSMakeRange(0, centerText.length))
-        centerText.addAttributes([NSAttributedStringKey.font: NSFont(name: "HelveticaNeue-Light", size: 13.0)!, NSAttributedStringKey.foregroundColor: NSColor.gray], range: NSMakeRange(10, centerText.length - 10))
-        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))
+        centerText.setAttributes([NSAttributedString.Key.font: NSFont(name: "HelveticaNeue-Light", size: 15.0)!, NSAttributedString.Key.paragraphStyle: paragraphStyle], range: NSMakeRange(0, centerText.length))
+        centerText.addAttributes([NSAttributedString.Key.font: NSFont(name: "HelveticaNeue-Light", size: 13.0)!, NSAttributedString.Key.foregroundColor: NSColor.gray], range: NSMakeRange(10, centerText.length - 10))
+        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))
         
         
         self.pieChartView.centerAttributedText = centerText
         self.pieChartView.centerAttributedText = centerText
         
         

+ 4 - 4
Source/Charts/Animation/Animator.swift

@@ -70,7 +70,7 @@ open class Animator: NSObject
     {
     {
         guard _displayLink != nil else { return }
         guard _displayLink != nil else { return }
 
 
-        _displayLink?.remove(from: .main, forMode: .commonModes)
+        _displayLink?.remove(from: .main, forMode: RunLoop.Mode.common)
         _displayLink = nil
         _displayLink = nil
 
 
         _enabledX = false
         _enabledX = false
@@ -163,7 +163,7 @@ open class Animator: NSObject
         if _enabledX || _enabledY
         if _enabledX || _enabledY
         {
         {
             _displayLink = NSUIDisplayLink(target: self, selector: #selector(animationLoop))
             _displayLink = NSUIDisplayLink(target: self, selector: #selector(animationLoop))
-            _displayLink?.add(to: RunLoop.main, forMode: RunLoopMode.commonModes)
+            _displayLink?.add(to: RunLoop.main, forMode: RunLoop.Mode.common)
         }
         }
     }
     }
     
     
@@ -219,7 +219,7 @@ open class Animator: NSObject
             _displayLink == nil
             _displayLink == nil
         {
         {
             _displayLink = NSUIDisplayLink(target: self, selector: #selector(animationLoop))
             _displayLink = NSUIDisplayLink(target: self, selector: #selector(animationLoop))
-            _displayLink?.add(to: .main, forMode: .commonModes)
+            _displayLink?.add(to: .main, forMode: RunLoop.Mode.common)
         }
         }
     }
     }
     
     
@@ -253,7 +253,7 @@ open class Animator: NSObject
             _displayLink == nil
             _displayLink == nil
         {
         {
             _displayLink = NSUIDisplayLink(target: self, selector: #selector(animationLoop))
             _displayLink = NSUIDisplayLink(target: self, selector: #selector(animationLoop))
-            _displayLink?.add(to: .main, forMode: .commonModes)
+            _displayLink?.add(to: .main, forMode: RunLoop.Mode.common)
         }
         }
     }
     }
     
     

+ 2 - 2
Source/Charts/Charts/BarLineChartViewBase.swift

@@ -775,7 +775,7 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD
                     _decelerationVelocity = recognizer.velocity(in: self)
                     _decelerationVelocity = recognizer.velocity(in: self)
                     
                     
                     _decelerationDisplayLink = NSUIDisplayLink(target: self, selector: #selector(BarLineChartViewBase.decelerationLoop))
                     _decelerationDisplayLink = NSUIDisplayLink(target: self, selector: #selector(BarLineChartViewBase.decelerationLoop))
-                    _decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoopMode.commonModes)
+                    _decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoop.Mode.common)
                 }
                 }
                 
                 
                 _isDragging = false
                 _isDragging = false
@@ -832,7 +832,7 @@ open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartD
     {
     {
         if _decelerationDisplayLink !== nil
         if _decelerationDisplayLink !== nil
         {
         {
-            _decelerationDisplayLink.remove(from: RunLoop.main, forMode: RunLoopMode.commonModes)
+            _decelerationDisplayLink.remove(from: RunLoop.main, forMode: RunLoop.Mode.common)
             _decelerationDisplayLink = nil
             _decelerationDisplayLink = nil
         }
         }
     }
     }

+ 3 - 3
Source/Charts/Charts/ChartViewBase.swift

@@ -354,10 +354,10 @@ open class ChartViewBase: NSUIView, ChartDataProvider, AnimatorDelegate
         let position = description.position ?? CGPoint(x: bounds.width - _viewPortHandler.offsetRight - description.xOffset,
         let position = description.position ?? CGPoint(x: bounds.width - _viewPortHandler.offsetRight - description.xOffset,
                                                        y: bounds.height - _viewPortHandler.offsetBottom - description.yOffset - description.font.lineHeight)
                                                        y: bounds.height - _viewPortHandler.offsetBottom - description.yOffset - description.font.lineHeight)
         
         
-        var attrs = [NSAttributedStringKey : Any]()
+        var attrs = [NSAttributedString.Key : Any]()
         
         
-        attrs[NSAttributedStringKey.font] = description.font
-        attrs[NSAttributedStringKey.foregroundColor] = description.textColor
+        attrs[NSAttributedString.Key.font] = description.font
+        attrs[NSAttributedString.Key.foregroundColor] = description.textColor
 
 
         ChartUtils.drawText(
         ChartUtils.drawText(
             context: context,
             context: context,

+ 3 - 3
Source/Charts/Charts/PieChartView.swift

@@ -398,9 +398,9 @@ open class PieChartView: PieRadarChartViewBase
                 
                 
                 attrString = NSMutableAttributedString(string: newValue!)
                 attrString = NSMutableAttributedString(string: newValue!)
                 attrString?.setAttributes([
                 attrString?.setAttributes([
-                    NSAttributedStringKey.foregroundColor: NSUIColor.black,
-                    NSAttributedStringKey.font: NSUIFont.systemFont(ofSize: 12.0),
-                    NSAttributedStringKey.paragraphStyle: paragraphStyle
+                    NSAttributedString.Key.foregroundColor: NSUIColor.black,
+                    NSAttributedString.Key.font: NSUIFont.systemFont(ofSize: 12.0),
+                    NSAttributedString.Key.paragraphStyle: paragraphStyle
                     ], range: NSMakeRange(0, attrString!.length))
                     ], range: NSMakeRange(0, attrString!.length))
             }
             }
             self.centerAttributedText = attrString
             self.centerAttributedText = attrString

+ 3 - 3
Source/Charts/Charts/PieRadarChartViewBase.swift

@@ -532,7 +532,7 @@ open class PieRadarChartViewBase: ChartViewBase
             {
             {
                 _decelerationLastTime = CACurrentMediaTime()
                 _decelerationLastTime = CACurrentMediaTime()
                 _decelerationDisplayLink = NSUIDisplayLink(target: self, selector: #selector(PieRadarChartViewBase.decelerationLoop))
                 _decelerationDisplayLink = NSUIDisplayLink(target: self, selector: #selector(PieRadarChartViewBase.decelerationLoop))
-                _decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoopMode.commonModes)
+                _decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoop.Mode.common)
             }
             }
         }
         }
     }
     }
@@ -768,7 +768,7 @@ open class PieRadarChartViewBase: ChartViewBase
     {
     {
         if _decelerationDisplayLink !== nil
         if _decelerationDisplayLink !== nil
         {
         {
-            _decelerationDisplayLink.remove(from: RunLoop.main, forMode: RunLoopMode.commonModes)
+            _decelerationDisplayLink.remove(from: RunLoop.main, forMode: RunLoop.Mode.common)
             _decelerationDisplayLink = nil
             _decelerationDisplayLink = nil
         }
         }
     }
     }
@@ -857,7 +857,7 @@ open class PieRadarChartViewBase: ChartViewBase
                 {
                 {
                     _decelerationLastTime = CACurrentMediaTime()
                     _decelerationLastTime = CACurrentMediaTime()
                     _decelerationDisplayLink = NSUIDisplayLink(target: self, selector: #selector(PieRadarChartViewBase.decelerationLoop))
                     _decelerationDisplayLink = NSUIDisplayLink(target: self, selector: #selector(PieRadarChartViewBase.decelerationLoop))
-                    _decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoopMode.commonModes)
+                    _decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoop.Mode.common)
                 }
                 }
             }
             }
         }
         }

+ 1 - 1
Source/Charts/Components/Legend.swift

@@ -315,7 +315,7 @@ open class Legend: ComponentBase
             
             
             // Start calculating layout
             // Start calculating layout
             
             
-            let labelAttrs = [NSAttributedStringKey.font: labelFont]
+            let labelAttrs = [NSAttributedString.Key.font: labelFont]
             var maxLineWidth: CGFloat = 0.0
             var maxLineWidth: CGFloat = 0.0
             var currentLineWidth: CGFloat = 0.0
             var currentLineWidth: CGFloat = 0.0
             var requiredWidth: CGFloat = 0.0
             var requiredWidth: CGFloat = 0.0

+ 1 - 1
Source/Charts/Components/YAxis.swift

@@ -117,7 +117,7 @@ open class YAxis: AxisBase
     @objc open func requiredSize() -> CGSize
     @objc open func requiredSize() -> CGSize
     {
     {
         let label = getLongestLabel() as NSString
         let label = getLongestLabel() as NSString
-        var size = label.size(withAttributes: [NSAttributedStringKey.font: labelFont])
+        var size = label.size(withAttributes: [NSAttributedString.Key.font: labelFont])
         size.width += xOffset * 2.0
         size.width += xOffset * 2.0
         size.height += yOffset * 2.0
         size.height += yOffset * 2.0
         size.width = max(minWidth, min(size.width, maxWidth > 0.0 ? maxWidth : size.width))
         size.width = max(minWidth, min(size.width, maxWidth > 0.0 ? maxWidth : size.width))

+ 2 - 2
Source/Charts/Jobs/AnimatedViewPortJob.swift

@@ -71,14 +71,14 @@ open class AnimatedViewPortJob: ViewPortJob
         updateAnimationPhase(_startTime)
         updateAnimationPhase(_startTime)
         
         
         _displayLink = NSUIDisplayLink(target: self, selector: #selector(animationLoop))
         _displayLink = NSUIDisplayLink(target: self, selector: #selector(animationLoop))
-        _displayLink.add(to: .main, forMode: .commonModes)
+        _displayLink.add(to: .main, forMode: RunLoop.Mode.common)
     }
     }
     
     
     @objc open func stop(finish: Bool)
     @objc open func stop(finish: Bool)
     {
     {
         guard _displayLink != nil else { return }
         guard _displayLink != nil else { return }
 
 
-        _displayLink.remove(from: .main, forMode: .commonModes)
+        _displayLink.remove(from: .main, forMode: RunLoop.Mode.common)
         _displayLink = nil
         _displayLink = nil
 
 
         if finish
         if finish

+ 1 - 1
Source/Charts/Renderers/BarChartRenderer.swift

@@ -683,7 +683,7 @@ open class BarChartRenderer: BarLineScatterCandleBubbleRenderer
     /// Draws a value at the specified x and y position.
     /// Draws a value at the specified x and y position.
     @objc open func drawValue(context: CGContext, value: String, xPos: CGFloat, yPos: CGFloat, font: NSUIFont, align: NSTextAlignment, color: NSUIColor)
     @objc open func drawValue(context: CGContext, value: String, xPos: CGFloat, yPos: CGFloat, font: NSUIFont, align: NSTextAlignment, color: NSUIColor)
     {
     {
-        ChartUtils.drawText(context: context, text: value, point: CGPoint(x: xPos, y: yPos), align: align, attributes: [NSAttributedStringKey.font: font, NSAttributedStringKey.foregroundColor: color])
+        ChartUtils.drawText(context: context, text: value, point: CGPoint(x: xPos, y: yPos), align: align, attributes: [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: color])
     }
     }
     
     
     open override func drawExtras(context: CGContext)
     open override func drawExtras(context: CGContext)

+ 1 - 1
Source/Charts/Renderers/BubbleChartRenderer.swift

@@ -221,7 +221,7 @@ open class BubbleChartRenderer: BarLineScatterCandleBubbleRenderer
                             x: pt.x,
                             x: pt.x,
                             y: pt.y - (0.5 * lineHeight)),
                             y: pt.y - (0.5 * lineHeight)),
                         align: .center,
                         align: .center,
-                        attributes: [NSAttributedStringKey.font: valueFont, NSAttributedStringKey.foregroundColor: valueTextColor])
+                        attributes: [NSAttributedString.Key.font: valueFont, NSAttributedString.Key.foregroundColor: valueTextColor])
                 }
                 }
 
 
                 if let icon = e.icon, dataSet.isDrawIconsEnabled
                 if let icon = e.icon, dataSet.isDrawIconsEnabled

+ 1 - 1
Source/Charts/Renderers/CandleStickChartRenderer.swift

@@ -346,7 +346,7 @@ open class CandleStickChartRenderer: LineScatterCandleRadarRenderer
                                 x: pt.x,
                                 x: pt.x,
                                 y: pt.y - yOffset),
                                 y: pt.y - yOffset),
                             align: .center,
                             align: .center,
-                            attributes: [NSAttributedStringKey.font: valueFont, NSAttributedStringKey.foregroundColor: dataSet.valueTextColorAt(j)])
+                            attributes: [NSAttributedString.Key.font: valueFont, NSAttributedString.Key.foregroundColor: dataSet.valueTextColorAt(j)])
                     }
                     }
                     
                     
                     if let icon = e.icon, dataSet.isDrawIconsEnabled
                     if let icon = e.icon, dataSet.isDrawIconsEnabled

+ 3 - 3
Source/Charts/Renderers/HorizontalBarChartRenderer.swift

@@ -391,7 +391,7 @@ open class HorizontalBarChartRenderer: BarChartRenderer
                             viewPortHandler: viewPortHandler)
                             viewPortHandler: viewPortHandler)
                         
                         
                         // calculate the correct offset depending on the draw position of the value
                         // calculate the correct offset depending on the draw position of the value
-                        let valueTextWidth = valueText.size(withAttributes: [NSAttributedStringKey.font: valueFont]).width
+                        let valueTextWidth = valueText.size(withAttributes: [NSAttributedString.Key.font: valueFont]).width
                         posOffset = (drawValueAboveBar ? valueOffsetPlus : -(valueTextWidth + valueOffsetPlus))
                         posOffset = (drawValueAboveBar ? valueOffsetPlus : -(valueTextWidth + valueOffsetPlus))
                         negOffset = (drawValueAboveBar ? -(valueTextWidth + valueOffsetPlus) : valueOffsetPlus)
                         negOffset = (drawValueAboveBar ? -(valueTextWidth + valueOffsetPlus) : valueOffsetPlus)
                         
                         
@@ -472,7 +472,7 @@ open class HorizontalBarChartRenderer: BarChartRenderer
                                 viewPortHandler: viewPortHandler)
                                 viewPortHandler: viewPortHandler)
                             
                             
                             // calculate the correct offset depending on the draw position of the value
                             // calculate the correct offset depending on the draw position of the value
-                            let valueTextWidth = valueText.size(withAttributes: [NSAttributedStringKey.font: valueFont]).width
+                            let valueTextWidth = valueText.size(withAttributes: [NSAttributedString.Key.font: valueFont]).width
                             posOffset = (drawValueAboveBar ? valueOffsetPlus : -(valueTextWidth + valueOffsetPlus))
                             posOffset = (drawValueAboveBar ? valueOffsetPlus : -(valueTextWidth + valueOffsetPlus))
                             negOffset = (drawValueAboveBar ? -(valueTextWidth + valueOffsetPlus) : valueOffsetPlus)
                             negOffset = (drawValueAboveBar ? -(valueTextWidth + valueOffsetPlus) : valueOffsetPlus)
                             
                             
@@ -556,7 +556,7 @@ open class HorizontalBarChartRenderer: BarChartRenderer
                                     viewPortHandler: viewPortHandler)
                                     viewPortHandler: viewPortHandler)
                                 
                                 
                                 // calculate the correct offset depending on the draw position of the value
                                 // calculate the correct offset depending on the draw position of the value
-                                let valueTextWidth = valueText.size(withAttributes: [NSAttributedStringKey.font: valueFont]).width
+                                let valueTextWidth = valueText.size(withAttributes: [NSAttributedString.Key.font: valueFont]).width
                                 posOffset = (drawValueAboveBar ? valueOffsetPlus : -(valueTextWidth + valueOffsetPlus))
                                 posOffset = (drawValueAboveBar ? valueOffsetPlus : -(valueTextWidth + valueOffsetPlus))
                                 negOffset = (drawValueAboveBar ? -(valueTextWidth + valueOffsetPlus) : valueOffsetPlus)
                                 negOffset = (drawValueAboveBar ? -(valueTextWidth + valueOffsetPlus) : valueOffsetPlus)
                                 
                                 

+ 1 - 1
Source/Charts/Renderers/LegendRenderer.swift

@@ -565,6 +565,6 @@ open class LegendRenderer: Renderer
     /// Draws the provided label at the given position.
     /// Draws the provided label at the given position.
     @objc open func drawLabel(context: CGContext, x: CGFloat, y: CGFloat, label: String, font: NSUIFont, textColor: NSUIColor)
     @objc open func drawLabel(context: CGContext, x: CGFloat, y: CGFloat, label: String, font: NSUIFont, textColor: NSUIColor)
     {
     {
-        ChartUtils.drawText(context: context, text: label, point: CGPoint(x: x, y: y), align: .left, attributes: [NSAttributedStringKey.font: font, NSAttributedStringKey.foregroundColor: textColor])
+        ChartUtils.drawText(context: context, text: label, point: CGPoint(x: x, y: y), align: .left, attributes: [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: textColor])
     }
     }
 }
 }

+ 1 - 1
Source/Charts/Renderers/LineChartRenderer.swift

@@ -574,7 +574,7 @@ open class LineChartRenderer: LineRadarRenderer
                                 x: pt.x,
                                 x: pt.x,
                                 y: pt.y - CGFloat(valOffset) - valueFont.lineHeight),
                                 y: pt.y - CGFloat(valOffset) - valueFont.lineHeight),
                             align: .center,
                             align: .center,
-                            attributes: [NSAttributedStringKey.font: valueFont, NSAttributedStringKey.foregroundColor: dataSet.valueTextColorAt(j)])
+                            attributes: [NSAttributedString.Key.font: valueFont, NSAttributedString.Key.foregroundColor: dataSet.valueTextColorAt(j)])
                     }
                     }
                     
                     
                     if let icon = e.icon, dataSet.isDrawIconsEnabled
                     if let icon = e.icon, dataSet.isDrawIconsEnabled

+ 12 - 12
Source/Charts/Renderers/PieChartRenderer.swift

@@ -457,7 +457,7 @@ open class PieChartRenderer: DataRenderer
                             text: valueText,
                             text: valueText,
                             point: labelPoint,
                             point: labelPoint,
                             align: align,
                             align: align,
-                            attributes: [NSAttributedStringKey.font: valueFont, NSAttributedStringKey.foregroundColor: valueTextColor]
+                            attributes: [NSAttributedString.Key.font: valueFont, NSAttributedString.Key.foregroundColor: valueTextColor]
                         )
                         )
 
 
                         if j < data.entryCount && pe?.label != nil
                         if j < data.entryCount && pe?.label != nil
@@ -468,8 +468,8 @@ open class PieChartRenderer: DataRenderer
                                 point: CGPoint(x: labelPoint.x, y: labelPoint.y + lineHeight),
                                 point: CGPoint(x: labelPoint.x, y: labelPoint.y + lineHeight),
                                 align: align,
                                 align: align,
                                 attributes: [
                                 attributes: [
-                                    NSAttributedStringKey.font: entryLabelFont ?? valueFont,
-                                    NSAttributedStringKey.foregroundColor: entryLabelColor ?? valueTextColor]
+                                    NSAttributedString.Key.font: entryLabelFont ?? valueFont,
+                                    NSAttributedString.Key.foregroundColor: entryLabelColor ?? valueTextColor]
                             )
                             )
                         }
                         }
                     }
                     }
@@ -483,8 +483,8 @@ open class PieChartRenderer: DataRenderer
                                 point: CGPoint(x: labelPoint.x, y: labelPoint.y + lineHeight / 2.0),
                                 point: CGPoint(x: labelPoint.x, y: labelPoint.y + lineHeight / 2.0),
                                 align: align,
                                 align: align,
                                 attributes: [
                                 attributes: [
-                                    NSAttributedStringKey.font: entryLabelFont ?? valueFont,
-                                    NSAttributedStringKey.foregroundColor: entryLabelColor ?? valueTextColor]
+                                    NSAttributedString.Key.font: entryLabelFont ?? valueFont,
+                                    NSAttributedString.Key.foregroundColor: entryLabelColor ?? valueTextColor]
                             )
                             )
                         }
                         }
                     }
                     }
@@ -495,7 +495,7 @@ open class PieChartRenderer: DataRenderer
                             text: valueText,
                             text: valueText,
                             point: CGPoint(x: labelPoint.x, y: labelPoint.y + lineHeight / 2.0),
                             point: CGPoint(x: labelPoint.x, y: labelPoint.y + lineHeight / 2.0),
                             align: align,
                             align: align,
-                            attributes: [NSAttributedStringKey.font: valueFont, NSAttributedStringKey.foregroundColor: valueTextColor]
+                            attributes: [NSAttributedString.Key.font: valueFont, NSAttributedString.Key.foregroundColor: valueTextColor]
                         )
                         )
                     }
                     }
                 }
                 }
@@ -513,7 +513,7 @@ open class PieChartRenderer: DataRenderer
                             text: valueText,
                             text: valueText,
                             point: CGPoint(x: x, y: y),
                             point: CGPoint(x: x, y: y),
                             align: .center,
                             align: .center,
-                            attributes: [NSAttributedStringKey.font: valueFont, NSAttributedStringKey.foregroundColor: valueTextColor]
+                            attributes: [NSAttributedString.Key.font: valueFont, NSAttributedString.Key.foregroundColor: valueTextColor]
                         )
                         )
 
 
                         if j < data.entryCount && pe?.label != nil
                         if j < data.entryCount && pe?.label != nil
@@ -524,8 +524,8 @@ open class PieChartRenderer: DataRenderer
                                 point: CGPoint(x: x, y: y + lineHeight),
                                 point: CGPoint(x: x, y: y + lineHeight),
                                 align: .center,
                                 align: .center,
                                 attributes: [
                                 attributes: [
-                                    NSAttributedStringKey.font: entryLabelFont ?? valueFont,
-                                    NSAttributedStringKey.foregroundColor: entryLabelColor ?? valueTextColor]
+                                    NSAttributedString.Key.font: entryLabelFont ?? valueFont,
+                                    NSAttributedString.Key.foregroundColor: entryLabelColor ?? valueTextColor]
                             )
                             )
                         }
                         }
                     }
                     }
@@ -539,8 +539,8 @@ open class PieChartRenderer: DataRenderer
                                 point: CGPoint(x: x, y: y + lineHeight / 2.0),
                                 point: CGPoint(x: x, y: y + lineHeight / 2.0),
                                 align: .center,
                                 align: .center,
                                 attributes: [
                                 attributes: [
-                                    NSAttributedStringKey.font: entryLabelFont ?? valueFont,
-                                    NSAttributedStringKey.foregroundColor: entryLabelColor ?? valueTextColor]
+                                    NSAttributedString.Key.font: entryLabelFont ?? valueFont,
+                                    NSAttributedString.Key.foregroundColor: entryLabelColor ?? valueTextColor]
                             )
                             )
                         }
                         }
                     }
                     }
@@ -551,7 +551,7 @@ open class PieChartRenderer: DataRenderer
                             text: valueText,
                             text: valueText,
                             point: CGPoint(x: x, y: y + lineHeight / 2.0),
                             point: CGPoint(x: x, y: y + lineHeight / 2.0),
                             align: .center,
                             align: .center,
-                            attributes: [NSAttributedStringKey.font: valueFont, NSAttributedStringKey.foregroundColor: valueTextColor]
+                            attributes: [NSAttributedString.Key.font: valueFont, NSAttributedString.Key.foregroundColor: valueTextColor]
                         )
                         )
                     }
                     }
                 }
                 }

+ 2 - 2
Source/Charts/Renderers/RadarChartRenderer.swift

@@ -258,8 +258,8 @@ open class RadarChartRenderer: LineRadarRenderer
                             viewPortHandler: viewPortHandler),
                             viewPortHandler: viewPortHandler),
                         point: CGPoint(x: p.x, y: p.y - yoffset - valueFont.lineHeight),
                         point: CGPoint(x: p.x, y: p.y - yoffset - valueFont.lineHeight),
                         align: .center,
                         align: .center,
-                        attributes: [NSAttributedStringKey.font: valueFont,
-                            NSAttributedStringKey.foregroundColor: dataSet.valueTextColorAt(j)]
+                        attributes: [NSAttributedString.Key.font: valueFont,
+                            NSAttributedString.Key.foregroundColor: dataSet.valueTextColorAt(j)]
                     )
                     )
                 }
                 }
                 
                 

+ 1 - 1
Source/Charts/Renderers/ScatterChartRenderer.swift

@@ -186,7 +186,7 @@ open class ScatterChartRenderer: LineScatterCandleRadarRenderer
                                 x: pt.x,
                                 x: pt.x,
                                 y: pt.y - shapeSize - lineHeight),
                                 y: pt.y - shapeSize - lineHeight),
                             align: .center,
                             align: .center,
-                            attributes: [NSAttributedStringKey.font: valueFont, NSAttributedStringKey.foregroundColor: dataSet.valueTextColorAt(j)]
+                            attributes: [NSAttributedString.Key.font: valueFont, NSAttributedString.Key.foregroundColor: dataSet.valueTextColorAt(j)]
                         )
                         )
                     }
                     }
                     
                     

+ 9 - 9
Source/Charts/Renderers/XAxisRenderer.swift

@@ -68,7 +68,7 @@ open class XAxisRenderer: AxisRendererBase
         
         
         let longest = xAxis.getLongestLabel()
         let longest = xAxis.getLongestLabel()
         
         
-        let labelSize = longest.size(withAttributes: [NSAttributedStringKey.font: xAxis.labelFont])
+        let labelSize = longest.size(withAttributes: [NSAttributedString.Key.font: xAxis.labelFont])
         
         
         let labelWidth = labelSize.width
         let labelWidth = labelSize.width
         let labelHeight = labelSize.height
         let labelHeight = labelSize.height
@@ -179,9 +179,9 @@ open class XAxisRenderer: AxisRendererBase
         #endif
         #endif
         paraStyle.alignment = .center
         paraStyle.alignment = .center
         
         
-        let labelAttrs: [NSAttributedStringKey : Any] = [NSAttributedStringKey.font: xAxis.labelFont,
-            NSAttributedStringKey.foregroundColor: xAxis.labelTextColor,
-            NSAttributedStringKey.paragraphStyle: paraStyle]
+        let labelAttrs: [NSAttributedString.Key : Any] = [NSAttributedString.Key.font: xAxis.labelFont,
+            NSAttributedString.Key.foregroundColor: xAxis.labelTextColor,
+            NSAttributedString.Key.paragraphStyle: paraStyle]
         let labelRotationAngleRadians = xAxis.labelRotationAngle.DEG2RAD
         let labelRotationAngleRadians = xAxis.labelRotationAngle.DEG2RAD
         
         
         let centeringEnabled = xAxis.isCenterAxisLabelsEnabled
         let centeringEnabled = xAxis.isCenterAxisLabelsEnabled
@@ -256,7 +256,7 @@ open class XAxisRenderer: AxisRendererBase
         formattedLabel: String,
         formattedLabel: String,
         x: CGFloat,
         x: CGFloat,
         y: CGFloat,
         y: CGFloat,
-        attributes: [NSAttributedStringKey : Any],
+        attributes: [NSAttributedString.Key : Any],
         constrainedToSize: CGSize,
         constrainedToSize: CGSize,
         anchor: CGPoint,
         anchor: CGPoint,
         angleRadians: CGFloat)
         angleRadians: CGFloat)
@@ -423,7 +423,7 @@ open class XAxisRenderer: AxisRendererBase
                         x: position.x + xOffset,
                         x: position.x + xOffset,
                         y: viewPortHandler.contentTop + yOffset),
                         y: viewPortHandler.contentTop + yOffset),
                     align: .left,
                     align: .left,
-                    attributes: [NSAttributedStringKey.font: limitLine.valueFont, NSAttributedStringKey.foregroundColor: limitLine.valueTextColor])
+                    attributes: [NSAttributedString.Key.font: limitLine.valueFont, NSAttributedString.Key.foregroundColor: limitLine.valueTextColor])
             }
             }
             else if limitLine.labelPosition == .rightBottom
             else if limitLine.labelPosition == .rightBottom
             {
             {
@@ -433,7 +433,7 @@ open class XAxisRenderer: AxisRendererBase
                         x: position.x + xOffset,
                         x: position.x + xOffset,
                         y: viewPortHandler.contentBottom - labelLineHeight - yOffset),
                         y: viewPortHandler.contentBottom - labelLineHeight - yOffset),
                     align: .left,
                     align: .left,
-                    attributes: [NSAttributedStringKey.font: limitLine.valueFont, NSAttributedStringKey.foregroundColor: limitLine.valueTextColor])
+                    attributes: [NSAttributedString.Key.font: limitLine.valueFont, NSAttributedString.Key.foregroundColor: limitLine.valueTextColor])
             }
             }
             else if limitLine.labelPosition == .leftTop
             else if limitLine.labelPosition == .leftTop
             {
             {
@@ -443,7 +443,7 @@ open class XAxisRenderer: AxisRendererBase
                         x: position.x - xOffset,
                         x: position.x - xOffset,
                         y: viewPortHandler.contentTop + yOffset),
                         y: viewPortHandler.contentTop + yOffset),
                     align: .right,
                     align: .right,
-                    attributes: [NSAttributedStringKey.font: limitLine.valueFont, NSAttributedStringKey.foregroundColor: limitLine.valueTextColor])
+                    attributes: [NSAttributedString.Key.font: limitLine.valueFont, NSAttributedString.Key.foregroundColor: limitLine.valueTextColor])
             }
             }
             else
             else
             {
             {
@@ -453,7 +453,7 @@ open class XAxisRenderer: AxisRendererBase
                         x: position.x - xOffset,
                         x: position.x - xOffset,
                         y: viewPortHandler.contentBottom - labelLineHeight - yOffset),
                         y: viewPortHandler.contentBottom - labelLineHeight - yOffset),
                     align: .right,
                     align: .right,
-                    attributes: [NSAttributedStringKey.font: limitLine.valueFont, NSAttributedStringKey.foregroundColor: limitLine.valueTextColor])
+                    attributes: [NSAttributedString.Key.font: limitLine.valueFont, NSAttributedString.Key.foregroundColor: limitLine.valueTextColor])
             }
             }
         }
         }
     }
     }

+ 7 - 7
Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift

@@ -64,7 +64,7 @@ open class XAxisRendererHorizontalBarChart: XAxisRenderer
        
        
         let longest = xAxis.getLongestLabel() as NSString
         let longest = xAxis.getLongestLabel() as NSString
         
         
-        let labelSize = longest.size(withAttributes: [NSAttributedStringKey.font: xAxis.labelFont])
+        let labelSize = longest.size(withAttributes: [NSAttributedString.Key.font: xAxis.labelFont])
         
         
         let labelWidth = floor(labelSize.width + xAxis.xOffset * 3.5)
         let labelWidth = floor(labelSize.width + xAxis.xOffset * 3.5)
         let labelHeight = labelSize.height
         let labelHeight = labelSize.height
@@ -155,7 +155,7 @@ open class XAxisRendererHorizontalBarChart: XAxisRenderer
                         formattedLabel: label,
                         formattedLabel: label,
                         x: pos,
                         x: pos,
                         y: position.y,
                         y: position.y,
-                        attributes: [NSAttributedStringKey.font: labelFont, NSAttributedStringKey.foregroundColor: labelTextColor],
+                        attributes: [NSAttributedString.Key.font: labelFont, NSAttributedString.Key.foregroundColor: labelTextColor],
                         anchor: anchor,
                         anchor: anchor,
                         angleRadians: labelRotationAngleRadians)
                         angleRadians: labelRotationAngleRadians)
                 }
                 }
@@ -168,7 +168,7 @@ open class XAxisRendererHorizontalBarChart: XAxisRenderer
         formattedLabel: String,
         formattedLabel: String,
         x: CGFloat,
         x: CGFloat,
         y: CGFloat,
         y: CGFloat,
-        attributes: [NSAttributedStringKey : Any],
+        attributes: [NSAttributedString.Key : Any],
         anchor: CGPoint,
         anchor: CGPoint,
         angleRadians: CGFloat)
         angleRadians: CGFloat)
     {
     {
@@ -322,7 +322,7 @@ open class XAxisRendererHorizontalBarChart: XAxisRenderer
                             x: viewPortHandler.contentRight - xOffset,
                             x: viewPortHandler.contentRight - xOffset,
                             y: position.y - yOffset),
                             y: position.y - yOffset),
                         align: .right,
                         align: .right,
-                        attributes: [NSAttributedStringKey.font: l.valueFont, NSAttributedStringKey.foregroundColor: l.valueTextColor])
+                        attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor])
                 }
                 }
                 else if l.labelPosition == .rightBottom
                 else if l.labelPosition == .rightBottom
                 {
                 {
@@ -332,7 +332,7 @@ open class XAxisRendererHorizontalBarChart: XAxisRenderer
                             x: viewPortHandler.contentRight - xOffset,
                             x: viewPortHandler.contentRight - xOffset,
                             y: position.y + yOffset - labelLineHeight),
                             y: position.y + yOffset - labelLineHeight),
                         align: .right,
                         align: .right,
-                        attributes: [NSAttributedStringKey.font: l.valueFont, NSAttributedStringKey.foregroundColor: l.valueTextColor])
+                        attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor])
                 }
                 }
                 else if l.labelPosition == .leftTop
                 else if l.labelPosition == .leftTop
                 {
                 {
@@ -342,7 +342,7 @@ open class XAxisRendererHorizontalBarChart: XAxisRenderer
                             x: viewPortHandler.contentLeft + xOffset,
                             x: viewPortHandler.contentLeft + xOffset,
                             y: position.y - yOffset),
                             y: position.y - yOffset),
                         align: .left,
                         align: .left,
-                        attributes: [NSAttributedStringKey.font: l.valueFont, NSAttributedStringKey.foregroundColor: l.valueTextColor])
+                        attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor])
                 }
                 }
                 else
                 else
                 {
                 {
@@ -352,7 +352,7 @@ open class XAxisRendererHorizontalBarChart: XAxisRenderer
                             x: viewPortHandler.contentLeft + xOffset,
                             x: viewPortHandler.contentLeft + xOffset,
                             y: position.y + yOffset - labelLineHeight),
                             y: position.y + yOffset - labelLineHeight),
                         align: .left,
                         align: .left,
-                        attributes: [NSAttributedStringKey.font: l.valueFont, NSAttributedStringKey.foregroundColor: l.valueTextColor])
+                        attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor])
                 }
                 }
             }
             }
         }
         }

+ 2 - 2
Source/Charts/Renderers/XAxisRendererRadarChart.swift

@@ -64,7 +64,7 @@ open class XAxisRendererRadarChart: XAxisRenderer
                       formattedLabel: label,
                       formattedLabel: label,
                       x: p.x,
                       x: p.x,
                       y: p.y - xAxis.labelRotatedHeight / 2.0,
                       y: p.y - xAxis.labelRotatedHeight / 2.0,
-                      attributes: [NSAttributedStringKey.font: labelFont, NSAttributedStringKey.foregroundColor: labelTextColor],
+                      attributes: [NSAttributedString.Key.font: labelFont, NSAttributedString.Key.foregroundColor: labelTextColor],
                       anchor: drawLabelAnchor,
                       anchor: drawLabelAnchor,
                       angleRadians: labelRotationAngleRadians)
                       angleRadians: labelRotationAngleRadians)
         }
         }
@@ -75,7 +75,7 @@ open class XAxisRendererRadarChart: XAxisRenderer
         formattedLabel: String,
         formattedLabel: String,
         x: CGFloat,
         x: CGFloat,
         y: CGFloat,
         y: CGFloat,
-        attributes: [NSAttributedStringKey : Any],
+        attributes: [NSAttributedString.Key : Any],
         anchor: CGPoint,
         anchor: CGPoint,
         angleRadians: CGFloat)
         angleRadians: CGFloat)
     {
     {

+ 5 - 5
Source/Charts/Renderers/YAxisRenderer.swift

@@ -147,7 +147,7 @@ open class YAxisRenderer: AxisRendererBase
                 text: text,
                 text: text,
                 point: CGPoint(x: fixedPosition, y: positions[i].y + offset),
                 point: CGPoint(x: fixedPosition, y: positions[i].y + offset),
                 align: textAlign,
                 align: textAlign,
-                attributes: [NSAttributedStringKey.font: labelFont, NSAttributedStringKey.foregroundColor: labelTextColor])
+                attributes: [NSAttributedString.Key.font: labelFont, NSAttributedString.Key.foregroundColor: labelTextColor])
         }
         }
     }
     }
     
     
@@ -352,7 +352,7 @@ open class YAxisRenderer: AxisRendererBase
                             x: viewPortHandler.contentRight - xOffset,
                             x: viewPortHandler.contentRight - xOffset,
                             y: position.y - yOffset),
                             y: position.y - yOffset),
                         align: .right,
                         align: .right,
-                        attributes: [NSAttributedStringKey.font: l.valueFont, NSAttributedStringKey.foregroundColor: l.valueTextColor])
+                        attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor])
                 }
                 }
                 else if l.labelPosition == .rightBottom
                 else if l.labelPosition == .rightBottom
                 {
                 {
@@ -362,7 +362,7 @@ open class YAxisRenderer: AxisRendererBase
                             x: viewPortHandler.contentRight - xOffset,
                             x: viewPortHandler.contentRight - xOffset,
                             y: position.y + yOffset - labelLineHeight),
                             y: position.y + yOffset - labelLineHeight),
                         align: .right,
                         align: .right,
-                        attributes: [NSAttributedStringKey.font: l.valueFont, NSAttributedStringKey.foregroundColor: l.valueTextColor])
+                        attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor])
                 }
                 }
                 else if l.labelPosition == .leftTop
                 else if l.labelPosition == .leftTop
                 {
                 {
@@ -372,7 +372,7 @@ open class YAxisRenderer: AxisRendererBase
                             x: viewPortHandler.contentLeft + xOffset,
                             x: viewPortHandler.contentLeft + xOffset,
                             y: position.y - yOffset),
                             y: position.y - yOffset),
                         align: .left,
                         align: .left,
-                        attributes: [NSAttributedStringKey.font: l.valueFont, NSAttributedStringKey.foregroundColor: l.valueTextColor])
+                        attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor])
                 }
                 }
                 else
                 else
                 {
                 {
@@ -382,7 +382,7 @@ open class YAxisRenderer: AxisRendererBase
                             x: viewPortHandler.contentLeft + xOffset,
                             x: viewPortHandler.contentLeft + xOffset,
                             y: position.y + yOffset - labelLineHeight),
                             y: position.y + yOffset - labelLineHeight),
                         align: .left,
                         align: .left,
-                        attributes: [NSAttributedStringKey.font: l.valueFont, NSAttributedStringKey.foregroundColor: l.valueTextColor])
+                        attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor])
                 }
                 }
             }
             }
         }
         }

+ 5 - 5
Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift

@@ -168,7 +168,7 @@ open class YAxisRendererHorizontalBarChart: YAxisRenderer
                 text: text,
                 text: text,
                 point: CGPoint(x: positions[i].x, y: fixedPosition - offset),
                 point: CGPoint(x: positions[i].x, y: fixedPosition - offset),
                 align: .center,
                 align: .center,
-                attributes: [NSAttributedStringKey.font: labelFont, NSAttributedStringKey.foregroundColor: labelTextColor])
+                attributes: [NSAttributedString.Key.font: labelFont, NSAttributedString.Key.foregroundColor: labelTextColor])
         }
         }
     }
     }
     
     
@@ -327,7 +327,7 @@ open class YAxisRendererHorizontalBarChart: YAxisRenderer
                             x: position.x + xOffset,
                             x: position.x + xOffset,
                             y: viewPortHandler.contentTop + yOffset),
                             y: viewPortHandler.contentTop + yOffset),
                         align: .left,
                         align: .left,
-                        attributes: [NSAttributedStringKey.font: l.valueFont, NSAttributedStringKey.foregroundColor: l.valueTextColor])
+                        attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor])
                 }
                 }
                 else if l.labelPosition == .rightBottom
                 else if l.labelPosition == .rightBottom
                 {
                 {
@@ -337,7 +337,7 @@ open class YAxisRendererHorizontalBarChart: YAxisRenderer
                             x: position.x + xOffset,
                             x: position.x + xOffset,
                             y: viewPortHandler.contentBottom - labelLineHeight - yOffset),
                             y: viewPortHandler.contentBottom - labelLineHeight - yOffset),
                         align: .left,
                         align: .left,
-                        attributes: [NSAttributedStringKey.font: l.valueFont, NSAttributedStringKey.foregroundColor: l.valueTextColor])
+                        attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor])
                 }
                 }
                 else if l.labelPosition == .leftTop
                 else if l.labelPosition == .leftTop
                 {
                 {
@@ -347,7 +347,7 @@ open class YAxisRendererHorizontalBarChart: YAxisRenderer
                             x: position.x - xOffset,
                             x: position.x - xOffset,
                             y: viewPortHandler.contentTop + yOffset),
                             y: viewPortHandler.contentTop + yOffset),
                         align: .right,
                         align: .right,
-                        attributes: [NSAttributedStringKey.font: l.valueFont, NSAttributedStringKey.foregroundColor: l.valueTextColor])
+                        attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor])
                 }
                 }
                 else
                 else
                 {
                 {
@@ -357,7 +357,7 @@ open class YAxisRendererHorizontalBarChart: YAxisRenderer
                             x: position.x - xOffset,
                             x: position.x - xOffset,
                             y: viewPortHandler.contentBottom - labelLineHeight - yOffset),
                             y: viewPortHandler.contentBottom - labelLineHeight - yOffset),
                         align: .right,
                         align: .right,
-                        attributes: [NSAttributedStringKey.font: l.valueFont, NSAttributedStringKey.foregroundColor: l.valueTextColor])
+                        attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor])
                 }
                 }
             }
             }
         }
         }

+ 2 - 2
Source/Charts/Renderers/YAxisRendererRadarChart.swift

@@ -199,8 +199,8 @@ open class YAxisRendererRadarChart: YAxisRenderer
                 point: CGPoint(x: p.x + xOffset, y: p.y - labelLineHeight),
                 point: CGPoint(x: p.x + xOffset, y: p.y - labelLineHeight),
                 align: alignment,
                 align: alignment,
                 attributes: [
                 attributes: [
-                    NSAttributedStringKey.font: labelFont,
-                    NSAttributedStringKey.foregroundColor: labelTextColor
+                    NSAttributedString.Key.font: labelFont,
+                    NSAttributedString.Key.foregroundColor: labelTextColor
                 ])
                 ])
         }
         }
     }
     }

+ 4 - 4
Source/Charts/Utils/ChartUtils.swift

@@ -156,7 +156,7 @@ open class ChartUtils
         NSUIGraphicsPopContext()
         NSUIGraphicsPopContext()
     }
     }
     
     
-    open class func drawText(context: CGContext, text: String, point: CGPoint, align: NSTextAlignment, attributes: [NSAttributedStringKey : Any]?)
+    open class func drawText(context: CGContext, text: String, point: CGPoint, align: NSTextAlignment, attributes: [NSAttributedString.Key : Any]?)
     {
     {
         var point = point
         var point = point
         
         
@@ -176,7 +176,7 @@ open class ChartUtils
         NSUIGraphicsPopContext()
         NSUIGraphicsPopContext()
     }
     }
     
     
-    open class func drawText(context: CGContext, text: String, point: CGPoint, attributes: [NSAttributedStringKey : Any]?, anchor: CGPoint, angleRadians: CGFloat)
+    open class func drawText(context: CGContext, text: String, point: CGPoint, attributes: [NSAttributedString.Key : Any]?, anchor: CGPoint, angleRadians: CGFloat)
     {
     {
         var drawOffset = CGPoint()
         var drawOffset = CGPoint()
         
         
@@ -228,7 +228,7 @@ open class ChartUtils
         NSUIGraphicsPopContext()
         NSUIGraphicsPopContext()
     }
     }
     
     
-    internal class func drawMultilineText(context: CGContext, text: String, knownTextSize: CGSize, point: CGPoint, attributes: [NSAttributedStringKey : Any]?, constrainedToSize: CGSize, anchor: CGPoint, angleRadians: CGFloat)
+    internal class func drawMultilineText(context: CGContext, text: String, knownTextSize: CGSize, point: CGPoint, attributes: [NSAttributedString.Key : Any]?, constrainedToSize: CGSize, anchor: CGPoint, angleRadians: CGFloat)
     {
     {
         var rect = CGRect(origin: CGPoint(), size: knownTextSize)
         var rect = CGRect(origin: CGPoint(), size: knownTextSize)
         
         
@@ -276,7 +276,7 @@ open class ChartUtils
         NSUIGraphicsPopContext()
         NSUIGraphicsPopContext()
     }
     }
     
     
-    internal class func drawMultilineText(context: CGContext, text: String, point: CGPoint, attributes: [NSAttributedStringKey : Any]?, constrainedToSize: CGSize, anchor: CGPoint, angleRadians: CGFloat)
+    internal class func drawMultilineText(context: CGContext, text: String, point: CGPoint, attributes: [NSAttributedString.Key : Any]?, constrainedToSize: CGSize, anchor: CGPoint, angleRadians: CGFloat)
     {
     {
         let rect = text.boundingRect(with: constrainedToSize, options: .usesLineFragmentOrigin, attributes: attributes, context: nil)
         let rect = text.boundingRect(with: constrainedToSize, options: .usesLineFragmentOrigin, attributes: attributes, context: nil)
         drawMultilineText(context: context, text: text, knownTextSize: rect.size, point: point, attributes: attributes, constrainedToSize: constrainedToSize, anchor: anchor, angleRadians: angleRadians)
         drawMultilineText(context: context, text: text, knownTextSize: rect.size, point: point, attributes: attributes, constrainedToSize: constrainedToSize, anchor: anchor, angleRadians: angleRadians)

+ 3 - 3
Source/Charts/Utils/Platform.swift

@@ -13,7 +13,7 @@ types are aliased to either their UI* implementation (on iOS) or their NS* imple
 	public typealias NSUIImage = UIImage
 	public typealias NSUIImage = UIImage
 	public typealias NSUIScrollView = UIScrollView
 	public typealias NSUIScrollView = UIScrollView
 	public typealias NSUIGestureRecognizer = UIGestureRecognizer
 	public typealias NSUIGestureRecognizer = UIGestureRecognizer
-	public typealias NSUIGestureRecognizerState = UIGestureRecognizerState
+public typealias NSUIGestureRecognizerState = UIGestureRecognizer.State
 	public typealias NSUIGestureRecognizerDelegate = UIGestureRecognizerDelegate
 	public typealias NSUIGestureRecognizerDelegate = UIGestureRecognizerDelegate
 	public typealias NSUITapGestureRecognizer = UITapGestureRecognizer
 	public typealias NSUITapGestureRecognizer = UITapGestureRecognizer
 	public typealias NSUIPanGestureRecognizer = UIPanGestureRecognizer
 	public typealias NSUIPanGestureRecognizer = UIPanGestureRecognizer
@@ -191,12 +191,12 @@ types are aliased to either their UI* implementation (on iOS) or their NS* imple
 
 
 	func NSUIImagePNGRepresentation(_ image: NSUIImage) -> Data?
 	func NSUIImagePNGRepresentation(_ image: NSUIImage) -> Data?
     {
     {
-		return UIImagePNGRepresentation(image)
+        return image.pngData()
 	}
 	}
 
 
 	func NSUIImageJPEGRepresentation(_ image: NSUIImage, _ quality: CGFloat = 0.8) -> Data?
 	func NSUIImageJPEGRepresentation(_ image: NSUIImage, _ quality: CGFloat = 0.8) -> Data?
     {
     {
-		return UIImageJPEGRepresentation(image, quality)
+		return image.jpegData(compressionQuality: quality)
 	}
 	}
 
 
 	func NSUIMainScreen() -> NSUIScreen?
 	func NSUIMainScreen() -> NSUIScreen?