Skip to content

Commit

Permalink
fix build errors after migration
Browse files Browse the repository at this point in the history
  • Loading branch information
pmairoldi committed Sep 7, 2017
1 parent 37cac1a commit a9e1e70
Show file tree
Hide file tree
Showing 20 changed files with 69 additions and 68 deletions.
6 changes: 3 additions & 3 deletions Source/Charts/Charts/ChartViewBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,8 @@ open class ChartViewBase: NSUIView, ChartDataProvider, AnimatorDelegate
text: noDataText,
point: CGPoint(x: frame.width / 2.0, y: frame.height / 2.0),
attributes:
[NSAttributedStringKey.font.rawValue: noDataFont,
NSAttributedStringKey.foregroundColor.rawValue: noDataTextColor],
[NSAttributedStringKey.font: noDataFont,
NSAttributedStringKey.foregroundColor: noDataTextColor],
constrainedToSize: self.bounds.size,
anchor: CGPoint(x: 0.5, y: 0.5),
angleRadians: 0.0)
Expand Down Expand Up @@ -405,7 +405,7 @@ open class ChartViewBase: NSUIView, ChartDataProvider, AnimatorDelegate
y: frame.height - _viewPortHandler.offsetBottom - description.yOffset - description.font.lineHeight)
}

var attrs = [String : AnyObject]()
var attrs = [NSAttributedStringKey : Any]()

attrs[NSAttributedStringKey.font] = description.font
attrs[NSAttributedStringKey.foregroundColor] = description.textColor
Expand Down
5 changes: 3 additions & 2 deletions Source/Charts/Charts/PieChartView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,12 @@ open class PieChartView: PieRadarChartViewBase
else
{
#if os(OSX)
let paragraphStyle = NSParagraphStyle.default().mutableCopy() as! NSMutableParagraphStyle
let paragraphStyle = NSParagraphStyle.default.mutableCopy() as! NSMutableParagraphStyle
paragraphStyle.lineBreakMode = NSParagraphStyle.LineBreakMode.byTruncatingTail
#else
let paragraphStyle = NSParagraphStyle.default.mutableCopy() as! NSMutableParagraphStyle
paragraphStyle.lineBreakMode = NSLineBreakMode.byTruncatingTail
#endif
paragraphStyle.lineBreakMode = NSLineBreakMode.byTruncatingTail
paragraphStyle.alignment = .center

attrString = NSMutableAttributedString(string: newValue!)
Expand Down
2 changes: 1 addition & 1 deletion Source/Charts/Components/Description.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ open class Description: ComponentBase
// 23 is the smallest recommended font size on the TV
font = NSUIFont.systemFont(ofSize: 23)
#elseif os(OSX)
font = NSUIFont.systemFont(ofSize: NSUIFont.systemFontSize())
font = NSUIFont.systemFont(ofSize: NSUIFont.systemFontSize)
#else
font = NSUIFont.systemFont(ofSize: 8.0)
#endif
Expand Down
4 changes: 2 additions & 2 deletions Source/Charts/Components/MarkerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ open class MarkerView: NSUIView, IMarker
#else

var loadedObjects = NSArray()
let loadedObjectsPointer = AutoreleasingUnsafeMutablePointer<NSArray>(&loadedObjects)
let loadedObjectsPointer = AutoreleasingUnsafeMutablePointer<NSArray?>(&loadedObjects)

if Bundle.main.loadNibNamed(
String(describing: self),
NSNib.Name(String(describing: self)),
owner: nil,
topLevelObjects: loadedObjectsPointer)
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Charts/Renderers/BarChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ open class BarChartRenderer: BarLineScatterCandleBubbleRenderer
/// 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)
{
ChartUtils.drawText(context: context, text: value, point: CGPoint(x: xPos, y: yPos), align: align, attributes: [NSAttributedStringKey.font.rawValue: font, NSAttributedStringKey.foregroundColor.rawValue: color])
ChartUtils.drawText(context: context, text: value, point: CGPoint(x: xPos, y: yPos), align: align, attributes: [NSAttributedStringKey.font: font, NSAttributedStringKey.foregroundColor: color])
}

open override func drawExtras(context: CGContext)
Expand Down
2 changes: 1 addition & 1 deletion Source/Charts/Renderers/BubbleChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ open class BubbleChartRenderer: BarLineScatterCandleBubbleRenderer
x: pt.x,
y: pt.y - (0.5 * lineHeight)),
align: .center,
attributes: [NSAttributedStringKey.font.rawValue: valueFont, NSAttributedStringKey.foregroundColor.rawValue: valueTextColor])
attributes: [NSAttributedStringKey.font: valueFont, NSAttributedStringKey.foregroundColor: valueTextColor])
}

if let icon = e.icon, dataSet.isDrawIconsEnabled
Expand Down
2 changes: 1 addition & 1 deletion Source/Charts/Renderers/CandleStickChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ open class CandleStickChartRenderer: LineScatterCandleRadarRenderer
x: pt.x,
y: pt.y - yOffset),
align: .center,
attributes: [NSAttributedStringKey.font.rawValue: valueFont, NSAttributedStringKey.foregroundColor.rawValue: dataSet.valueTextColorAt(j)])
attributes: [NSAttributedStringKey.font: valueFont, NSAttributedStringKey.foregroundColor: dataSet.valueTextColorAt(j)])
}

if let icon = e.icon, dataSet.isDrawIconsEnabled
Expand Down
2 changes: 1 addition & 1 deletion Source/Charts/Renderers/LegendRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,6 @@ open class LegendRenderer: Renderer
/// Draws the provided label at the given position.
@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.rawValue: font, NSAttributedStringKey.foregroundColor.rawValue: textColor])
ChartUtils.drawText(context: context, text: label, point: CGPoint(x: x, y: y), align: .left, attributes: [NSAttributedStringKey.font: font, NSAttributedStringKey.foregroundColor: textColor])
}
}
2 changes: 1 addition & 1 deletion Source/Charts/Renderers/LineChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ open class LineChartRenderer: LineRadarRenderer
x: pt.x,
y: pt.y - CGFloat(valOffset) - valueFont.lineHeight),
align: .center,
attributes: [NSAttributedStringKey.font.rawValue: valueFont, NSAttributedStringKey.foregroundColor.rawValue: dataSet.valueTextColorAt(j)])
attributes: [NSAttributedStringKey.font: valueFont, NSAttributedStringKey.foregroundColor: dataSet.valueTextColorAt(j)])
}

if let icon = e.icon, dataSet.isDrawIconsEnabled
Expand Down
24 changes: 12 additions & 12 deletions Source/Charts/Renderers/PieChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ open class PieChartRenderer: DataRenderer
text: valueText,
point: labelPoint,
align: align,
attributes: [NSAttributedStringKey.font.rawValue: valueFont, NSAttributedStringKey.foregroundColor.rawValue: valueTextColor]
attributes: [NSAttributedStringKey.font: valueFont, NSAttributedStringKey.foregroundColor: valueTextColor]
)

if j < data.entryCount && pe?.label != nil
Expand All @@ -442,8 +442,8 @@ open class PieChartRenderer: DataRenderer
point: CGPoint(x: labelPoint.x, y: labelPoint.y + lineHeight),
align: align,
attributes: [
NSAttributedStringKey.font.rawValue: entryLabelFont ?? valueFont,
NSAttributedStringKey.foregroundColor.rawValue: entryLabelColor ?? valueTextColor]
NSAttributedStringKey.font: entryLabelFont ?? valueFont,
NSAttributedStringKey.foregroundColor: entryLabelColor ?? valueTextColor]
)
}
}
Expand All @@ -457,8 +457,8 @@ open class PieChartRenderer: DataRenderer
point: CGPoint(x: labelPoint.x, y: labelPoint.y + lineHeight / 2.0),
align: align,
attributes: [
NSAttributedStringKey.font.rawValue: entryLabelFont ?? valueFont,
NSAttributedStringKey.foregroundColor.rawValue: entryLabelColor ?? valueTextColor]
NSAttributedStringKey.font: entryLabelFont ?? valueFont,
NSAttributedStringKey.foregroundColor: entryLabelColor ?? valueTextColor]
)
}
}
Expand All @@ -469,7 +469,7 @@ open class PieChartRenderer: DataRenderer
text: valueText,
point: CGPoint(x: labelPoint.x, y: labelPoint.y + lineHeight / 2.0),
align: align,
attributes: [NSAttributedStringKey.font.rawValue: valueFont, NSAttributedStringKey.foregroundColor.rawValue: valueTextColor]
attributes: [NSAttributedStringKey.font: valueFont, NSAttributedStringKey.foregroundColor: valueTextColor]
)
}
}
Expand All @@ -487,7 +487,7 @@ open class PieChartRenderer: DataRenderer
text: valueText,
point: CGPoint(x: x, y: y),
align: .center,
attributes: [NSAttributedStringKey.font.rawValue: valueFont, NSAttributedStringKey.foregroundColor.rawValue: valueTextColor]
attributes: [NSAttributedStringKey.font: valueFont, NSAttributedStringKey.foregroundColor: valueTextColor]
)

if j < data.entryCount && pe?.label != nil
Expand All @@ -498,8 +498,8 @@ open class PieChartRenderer: DataRenderer
point: CGPoint(x: x, y: y + lineHeight),
align: .center,
attributes: [
NSAttributedStringKey.font.rawValue: entryLabelFont ?? valueFont,
NSAttributedStringKey.foregroundColor.rawValue: entryLabelColor ?? valueTextColor]
NSAttributedStringKey.font: entryLabelFont ?? valueFont,
NSAttributedStringKey.foregroundColor: entryLabelColor ?? valueTextColor]
)
}
}
Expand All @@ -513,8 +513,8 @@ open class PieChartRenderer: DataRenderer
point: CGPoint(x: x, y: y + lineHeight / 2.0),
align: .center,
attributes: [
NSAttributedStringKey.font.rawValue: entryLabelFont ?? valueFont,
NSAttributedStringKey.foregroundColor.rawValue: entryLabelColor ?? valueTextColor]
NSAttributedStringKey.font: entryLabelFont ?? valueFont,
NSAttributedStringKey.foregroundColor: entryLabelColor ?? valueTextColor]
)
}
}
Expand All @@ -525,7 +525,7 @@ open class PieChartRenderer: DataRenderer
text: valueText,
point: CGPoint(x: x, y: y + lineHeight / 2.0),
align: .center,
attributes: [NSAttributedStringKey.font.rawValue: valueFont, NSAttributedStringKey.foregroundColor.rawValue: valueTextColor]
attributes: [NSAttributedStringKey.font: valueFont, NSAttributedStringKey.foregroundColor: valueTextColor]
)
}
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Charts/Renderers/RadarChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ open class RadarChartRenderer: LineRadarRenderer
viewPortHandler: viewPortHandler),
point: CGPoint(x: p.x, y: p.y - yoffset - valueFont.lineHeight),
align: .center,
attributes: [NSAttributedStringKey.font.rawValue: valueFont,
NSAttributedStringKey.foregroundColor.rawValue: dataSet.valueTextColorAt(j)]
attributes: [NSAttributedStringKey.font: valueFont,
NSAttributedStringKey.foregroundColor: dataSet.valueTextColorAt(j)]
)
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Charts/Renderers/ScatterChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ open class ScatterChartRenderer: LineScatterCandleRadarRenderer
x: pt.x,
y: pt.y - shapeSize - lineHeight),
align: .center,
attributes: [NSAttributedStringKey.font.rawValue: valueFont, NSAttributedStringKey.foregroundColor.rawValue: dataSet.valueTextColorAt(j)]
attributes: [NSAttributedStringKey.font: valueFont, NSAttributedStringKey.foregroundColor: dataSet.valueTextColorAt(j)]
)
}

Expand Down
16 changes: 8 additions & 8 deletions Source/Charts/Renderers/XAxisRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,15 @@ open class XAxisRenderer: AxisRendererBase
else { return }

#if os(OSX)
let paraStyle = NSParagraphStyle.default().mutableCopy() as! NSMutableParagraphStyle
let paraStyle = NSParagraphStyle.default.mutableCopy() as! NSMutableParagraphStyle
#else
let paraStyle = NSParagraphStyle.default.mutableCopy() as! NSMutableParagraphStyle
#endif
paraStyle.alignment = .center

let labelAttrs = [NSAttributedStringKey.font.rawValue: xAxis.labelFont,
let labelAttrs: [NSAttributedStringKey : Any] = [NSAttributedStringKey.font: xAxis.labelFont,
NSAttributedStringKey.foregroundColor: xAxis.labelTextColor,
NSAttributedStringKey.paragraphStyle: paraStyle] as! [String : NSObject]
NSAttributedStringKey.paragraphStyle: paraStyle]
let labelRotationAngleRadians = xAxis.labelRotationAngle * ChartUtils.Math.FDEG2RAD

let centeringEnabled = xAxis.isCenterAxisLabelsEnabled
Expand Down Expand Up @@ -267,7 +267,7 @@ open class XAxisRenderer: AxisRendererBase
formattedLabel: String,
x: CGFloat,
y: CGFloat,
attributes: [String: NSObject],
attributes: [NSAttributedStringKey : Any],
constrainedToSize: CGSize,
anchor: CGPoint,
angleRadians: CGFloat)
Expand Down Expand Up @@ -445,7 +445,7 @@ open class XAxisRenderer: AxisRendererBase
x: position.x + xOffset,
y: viewPortHandler.contentTop + yOffset),
align: .left,
attributes: [NSAttributedStringKey.font.rawValue: limitLine.valueFont, NSAttributedStringKey.foregroundColor.rawValue: limitLine.valueTextColor])
attributes: [NSAttributedStringKey.font: limitLine.valueFont, NSAttributedStringKey.foregroundColor: limitLine.valueTextColor])
}
else if limitLine.labelPosition == .rightBottom
{
Expand All @@ -455,7 +455,7 @@ open class XAxisRenderer: AxisRendererBase
x: position.x + xOffset,
y: viewPortHandler.contentBottom - labelLineHeight - yOffset),
align: .left,
attributes: [NSAttributedStringKey.font.rawValue: limitLine.valueFont, NSAttributedStringKey.foregroundColor.rawValue: limitLine.valueTextColor])
attributes: [NSAttributedStringKey.font: limitLine.valueFont, NSAttributedStringKey.foregroundColor: limitLine.valueTextColor])
}
else if limitLine.labelPosition == .leftTop
{
Expand All @@ -465,7 +465,7 @@ open class XAxisRenderer: AxisRendererBase
x: position.x - xOffset,
y: viewPortHandler.contentTop + yOffset),
align: .right,
attributes: [NSAttributedStringKey.font.rawValue: limitLine.valueFont, NSAttributedStringKey.foregroundColor.rawValue: limitLine.valueTextColor])
attributes: [NSAttributedStringKey.font: limitLine.valueFont, NSAttributedStringKey.foregroundColor: limitLine.valueTextColor])
}
else
{
Expand All @@ -475,7 +475,7 @@ open class XAxisRenderer: AxisRendererBase
x: position.x - xOffset,
y: viewPortHandler.contentBottom - labelLineHeight - yOffset),
align: .right,
attributes: [NSAttributedStringKey.font.rawValue: limitLine.valueFont, NSAttributedStringKey.foregroundColor.rawValue: limitLine.valueTextColor])
attributes: [NSAttributedStringKey.font: limitLine.valueFont, NSAttributedStringKey.foregroundColor: limitLine.valueTextColor])
}
}
}
Expand Down
Loading

0 comments on commit a9e1e70

Please sign in to comment.