Skip to content

Commit

Permalink
Fixes xcode beta 5 compile errors (fixes #287)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmairoldi authored and danielgindi committed Sep 18, 2015
1 parent dc4e3c4 commit 0ba2102
Show file tree
Hide file tree
Showing 30 changed files with 158 additions and 107 deletions.
10 changes: 9 additions & 1 deletion Charts/Charts.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
06A5D1861B78675500915098 /* UIGraphics+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06A5D1851B78675500915098 /* UIGraphics+Extensions.swift */; };
06A5D1881B7868AF00915098 /* CALayer+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06A5D1871B7868AF00915098 /* CALayer+Extensions.swift */; };
55E356531ADC63BF00A57971 /* BubbleChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55E356521ADC63BF00A57971 /* BubbleChartView.swift */; };
55E356571ADC63CD00A57971 /* BubbleChartData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55E356541ADC63CD00A57971 /* BubbleChartData.swift */; };
55E356581ADC63CD00A57971 /* BubbleChartDataEntry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55E356551ADC63CD00A57971 /* BubbleChartDataEntry.swift */; };
Expand Down Expand Up @@ -93,6 +95,8 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
06A5D1851B78675500915098 /* UIGraphics+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIGraphics+Extensions.swift"; sourceTree = "<group>"; };
06A5D1871B7868AF00915098 /* CALayer+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CALayer+Extensions.swift"; sourceTree = "<group>"; };
55E356521ADC63BF00A57971 /* BubbleChartView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BubbleChartView.swift; sourceTree = "<group>"; };
55E356541ADC63CD00A57971 /* BubbleChartData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BubbleChartData.swift; sourceTree = "<group>"; };
55E356551ADC63CD00A57971 /* BubbleChartDataEntry.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BubbleChartDataEntry.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -129,7 +133,7 @@
5B6A54901AA66A8D000F57C2 /* ChartDataRendererBase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChartDataRendererBase.swift; sourceTree = "<group>"; };
5B6A54921AA66AAB000F57C2 /* CombinedChartRenderer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CombinedChartRenderer.swift; sourceTree = "<group>"; };
5B6A54941AA66AC0000F57C2 /* CandleStickChartRenderer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CandleStickChartRenderer.swift; sourceTree = "<group>"; };
5B6A54961AA66AD2000F57C2 /* BarChartRenderer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BarChartRenderer.swift; sourceTree = "<group>"; };
5B6A54961AA66AD2000F57C2 /* BarChartRenderer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = BarChartRenderer.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
5B6A54981AA66B14000F57C2 /* BarChartView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BarChartView.swift; sourceTree = "<group>"; };
5B6A549A1AA66B2C000F57C2 /* BarLineChartViewBase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = BarLineChartViewBase.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
5B6A549C1AA66B3C000F57C2 /* CandleStickChartView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CandleStickChartView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -375,6 +379,8 @@
5BB6EC1C1ACC28AB006E9C25 /* ChartTransformerHorizontalBarChart.swift */,
5BA8EC7C1A9D151C00CE82E1 /* ChartUtils.swift */,
5BD8F06C1AB897D500566E05 /* ChartViewPortHandler.swift */,
06A5D1851B78675500915098 /* UIGraphics+Extensions.swift */,
06A5D1871B7868AF00915098 /* CALayer+Extensions.swift */,
);
path = Utils;
sourceTree = "<group>";
Expand Down Expand Up @@ -502,6 +508,7 @@
5BA8EC7D1A9D151C00CE82E1 /* ChartViewBase.swift in Sources */,
5B6A54DC1AA74516000F57C2 /* PieChartDataSet.swift in Sources */,
5B6A54DA1AA74516000F57C2 /* LineRadarChartDataSet.swift in Sources */,
06A5D1861B78675500915098 /* UIGraphics+Extensions.swift in Sources */,
5B6A54701AA5DB34000F57C2 /* ChartRendererBase.swift in Sources */,
5B6A54761AA5DEE3000F57C2 /* ChartXAxisRendererBarChart.swift in Sources */,
5B6A54851AA669C9000F57C2 /* ScatterChartRenderer.swift in Sources */,
Expand All @@ -522,6 +529,7 @@
5B6A54DF1AA74516000F57C2 /* ScatterChartData.swift in Sources */,
5B6A54D31AA74516000F57C2 /* CandleChartDataSet.swift in Sources */,
5B0032491B6525FC00B6A2FE /* ChartHighlighter.swift in Sources */,
06A5D1881B7868AF00915098 /* CALayer+Extensions.swift in Sources */,
5B6A54D71AA74516000F57C2 /* ChartDataSet.swift in Sources */,
5B00324B1B652BF900B6A2FE /* BarChartHighlighter.swift in Sources */,
5B6A54781AA5DEF0000F57C2 /* ChartXAxisRendererRadarChart.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion Charts/Classes/Charts/BarLineChartViewBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ public class BarLineChartViewBase: ChartViewBase, UIGestureRecognizerDelegate
}

/// draws the grid background
internal func drawGridBackground(context context: CGContext)
internal func drawGridBackground(context context: CGContext?)
{
if (drawGridBackgroundEnabled || drawBordersEnabled)
{
Expand Down
8 changes: 4 additions & 4 deletions Charts/Classes/Charts/ChartViewBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public class ChartViewBase: UIView, ChartAnimatorDelegate
{
let context = UIGraphicsGetCurrentContext()
let frame = self.bounds

if (_dataNotSet || _data === nil || _data.yValCount == 0)
{ // check if there is data

Expand Down Expand Up @@ -319,7 +319,7 @@ public class ChartViewBase: UIView, ChartAnimatorDelegate
}

/// draws the description text in the bottom right corner of the chart
internal func drawDescription(context context: CGContext)
internal func drawDescription(context context: CGContext?)
{
if (descriptionText.lengthOfBytesUsingEncoding(NSUTF16StringEncoding) == 0)
{
Expand Down Expand Up @@ -439,7 +439,7 @@ public class ChartViewBase: UIView, ChartAnimatorDelegate
// MARK: - Markers

/// draws all MarkerViews on the highlighted positions
internal func drawMarkers(context context: CGContext)
internal func drawMarkers(context context: CGContext?)
{
// if there is no marker view or drawing marker is disabled
if (marker === nil || !drawMarkers || !valuesToHighlight())
Expand Down Expand Up @@ -776,7 +776,7 @@ public class ChartViewBase: UIView, ChartAnimatorDelegate
}
}

layer.renderInContext(UIGraphicsGetCurrentContext())
layer.renderInOptionalContext(context)

let image = UIGraphicsGetImageFromCurrentImageContext()

Expand Down
2 changes: 1 addition & 1 deletion Charts/Classes/Components/ChartMarker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class ChartMarker: ChartComponentBase
}

/// Draws the ChartMarker on the given position on the given context
public func draw(context context: CGContext, point: CGPoint)
public func draw(context context: CGContext?, point: CGPoint)
{
let offset = self.offset
let size = self.size
Expand Down
6 changes: 1 addition & 5 deletions Charts/Classes/Data/ChartDataEntry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,7 @@ public class ChartDataEntry: NSObject

public func copyWithZone(zone: NSZone) -> AnyObject
{
let copy = self.dynamicType.allocWithZone(zone) as ChartDataEntry
copy.value = value
copy.xIndex = xIndex
copy.data = data
return copy
return ChartDataEntry(value: value, xIndex: xIndex, data: data)
}
}

Expand Down
6 changes: 4 additions & 2 deletions Charts/Classes/Data/ChartDataSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,15 @@ public class ChartDataSet: NSObject

public func copyWithZone(zone: NSZone) -> AnyObject
{
let copy = self.dynamicType.allocWithZone(zone) as ChartDataSet
let copy = ChartDataSet()
copy.colors = colors
copy._yVals = _yVals
copy._yMax = _yMax
copy._yMin = _yMin
copy._yValueSum = _yValueSum
copy.label = self.label
copy._lastStart = _lastStart
copy._lastEnd = _lastEnd
copy.label = label
return copy
}
}
Expand Down
12 changes: 6 additions & 6 deletions Charts/Classes/Renderers/BarChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class BarChartRenderer: ChartDataRendererBase
self.delegate = delegate
}

public override func drawData(context context: CGContext)
public override func drawData(context context: CGContext?)
{
let barData = delegate!.barChartRendererData(self)

Expand All @@ -63,7 +63,7 @@ public class BarChartRenderer: ChartDataRendererBase
}
}

internal func drawDataSet(context context: CGContext, dataSet: BarChartDataSet, index: Int)
internal func drawDataSet(context context: CGContext?, dataSet: BarChartDataSet, index: Int)
{
CGContextSaveGState(context)

Expand Down Expand Up @@ -273,7 +273,7 @@ public class BarChartRenderer: ChartDataRendererBase
trans.rectValueToPixel(&rect, phaseY: _animator.phaseY)
}

public override func drawValues(context context: CGContext)
public override func drawValues(context context: CGContext?)
{
// if values are drawn
if (passesCheck())
Expand Down Expand Up @@ -448,19 +448,19 @@ public class BarChartRenderer: ChartDataRendererBase
}

/// Draws a value at the specified x and y position.
internal func drawValue(context context: CGContext, value: String, xPos: CGFloat, yPos: CGFloat, font: UIFont, align: NSTextAlignment, color: UIColor)
internal func drawValue(context context: CGContext?, value: String, xPos: CGFloat, yPos: CGFloat, font: UIFont, align: NSTextAlignment, color: UIColor)
{
ChartUtils.drawText(context: context, text: value, point: CGPoint(x: xPos, y: yPos), align: align, attributes: [NSFontAttributeName: font, NSForegroundColorAttributeName: color])
}

public override func drawExtras(context context: CGContext)
public override func drawExtras(context context: CGContext?)
{

}

private var _highlightArrowPtsBuffer = [CGPoint](count: 3, repeatedValue: CGPoint())

public override func drawHighlighted(context context: CGContext, indices: [ChartHighlight])
public override func drawHighlighted(context context: CGContext?, indices: [ChartHighlight])
{
let barData = delegate!.barChartRendererData(self)
if (barData === nil)
Expand Down
10 changes: 5 additions & 5 deletions Charts/Classes/Renderers/BubbleChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class BubbleChartRenderer: ChartDataRendererBase
self.delegate = delegate
}

public override func drawData(context context: CGContext)
public override func drawData(context context: CGContext?)
{
let bubbleData = delegate!.bubbleChartRendererData(self)

Expand All @@ -61,7 +61,7 @@ public class BubbleChartRenderer: ChartDataRendererBase
private var _pointBuffer = CGPoint()
private var _sizeBuffer = [CGPoint](count: 2, repeatedValue: CGPoint())

internal func drawDataSet(context context: CGContext, dataSet: BubbleChartDataSet)
internal func drawDataSet(context context: CGContext?, dataSet: BubbleChartDataSet)
{
let trans = delegate!.bubbleChartRenderer(self, transformerForAxis: dataSet.axisDependency)

Expand Down Expand Up @@ -135,7 +135,7 @@ public class BubbleChartRenderer: ChartDataRendererBase
CGContextRestoreGState(context)
}

public override func drawValues(context context: CGContext)
public override func drawValues(context context: CGContext?)
{
let bubbleData = delegate!.bubbleChartRendererData(self)
if (bubbleData === nil)
Expand Down Expand Up @@ -203,12 +203,12 @@ public class BubbleChartRenderer: ChartDataRendererBase
}
}

public override func drawExtras(context context: CGContext)
public override func drawExtras(context context: CGContext?)
{

}

public override func drawHighlighted(context context: CGContext, indices: [ChartHighlight])
public override func drawHighlighted(context context: CGContext?, indices: [ChartHighlight])
{
let bubbleData = delegate!.bubbleChartRendererData(self)

Expand Down
10 changes: 5 additions & 5 deletions Charts/Classes/Renderers/CandleStickChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class CandleStickChartRenderer: LineScatterCandleRadarChartRenderer
self.delegate = delegate
}

public override func drawData(context context: CGContext)
public override func drawData(context context: CGContext?)
{
let candleData = delegate!.candleStickChartRendererCandleData(self)

Expand All @@ -56,7 +56,7 @@ public class CandleStickChartRenderer: LineScatterCandleRadarChartRenderer
private var _bodyRect = CGRect()
private var _lineSegments = [CGPoint](count: 2, repeatedValue: CGPoint())

internal func drawDataSet(context context: CGContext, dataSet: CandleChartDataSet)
internal func drawDataSet(context context: CGContext?, dataSet: CandleChartDataSet)
{
let trans = delegate!.candleStickChartRenderer(self, transformerForAxis: dataSet.axisDependency)

Expand Down Expand Up @@ -166,7 +166,7 @@ public class CandleStickChartRenderer: LineScatterCandleRadarChartRenderer
CGContextRestoreGState(context)
}

public override func drawValues(context context: CGContext)
public override func drawValues(context context: CGContext?)
{
let candleData = delegate!.candleStickChartRendererCandleData(self)
if (candleData === nil)
Expand Down Expand Up @@ -234,12 +234,12 @@ public class CandleStickChartRenderer: LineScatterCandleRadarChartRenderer
}
}

public override func drawExtras(context context: CGContext)
public override func drawExtras(context context: CGContext?)
{
}

private var _highlightPtsBuffer = [CGPoint](count: 4, repeatedValue: CGPoint())
public override func drawHighlighted(context context: CGContext, indices: [ChartHighlight])
public override func drawHighlighted(context context: CGContext?, indices: [ChartHighlight])
{
let candleData = delegate!.candleStickChartRendererCandleData(self)
if (candleData === nil)
Expand Down
8 changes: 4 additions & 4 deletions Charts/Classes/Renderers/ChartAxisRendererBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,25 @@ public class ChartAxisRendererBase: ChartRendererBase
}

/// Draws the axis labels on the specified context
public func renderAxisLabels(context context: CGContext)
public func renderAxisLabels(context context: CGContext?)
{
fatalError("renderAxisLabels() cannot be called on ChartAxisRendererBase")
}

/// Draws the grid lines belonging to the axis.
public func renderGridLines(context context: CGContext)
public func renderGridLines(context context: CGContext?)
{
fatalError("renderGridLines() cannot be called on ChartAxisRendererBase")
}

/// Draws the line that goes alongside the axis.
public func renderAxisLine(context context: CGContext)
public func renderAxisLine(context context: CGContext?)
{
fatalError("renderAxisLine() cannot be called on ChartAxisRendererBase")
}

/// Draws the LimitLines associated with this axis to the screen.
public func renderLimitLines(context context: CGContext)
public func renderLimitLines(context context: CGContext?)
{
fatalError("renderLimitLines() cannot be called on ChartAxisRendererBase")
}
Expand Down
8 changes: 4 additions & 4 deletions Charts/Classes/Renderers/ChartDataRendererBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@ public class ChartDataRendererBase: ChartRendererBase
_animator = animator
}

public func drawData(context context: CGContext)
public func drawData(context context: CGContext?)
{
fatalError("drawData() cannot be called on ChartDataRendererBase")
}

public func drawValues(context context: CGContext)
public func drawValues(context context: CGContext?)
{
fatalError("drawValues() cannot be called on ChartDataRendererBase")
}

public func drawExtras(context context: CGContext)
public func drawExtras(context context: CGContext?)
{
fatalError("drawExtras() cannot be called on ChartDataRendererBase")
}

public func drawHighlighted(context context: CGContext, indices: [ChartHighlight])
public func drawHighlighted(context context: CGContext?, indices: [ChartHighlight])
{
fatalError("drawHighlighted() cannot be called on ChartDataRendererBase")
}
Expand Down
6 changes: 3 additions & 3 deletions Charts/Classes/Renderers/ChartLegendRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public class ChartLegendRenderer: ChartRendererBase
_legend.calculateDimensions(labelFont: _legend.font, viewPortHandler: viewPortHandler)
}

public func renderLegend(context context: CGContext)
public func renderLegend(context context: CGContext?)
{
if (_legend === nil || !_legend.enabled)
{
Expand Down Expand Up @@ -364,7 +364,7 @@ public class ChartLegendRenderer: ChartRendererBase
private var _formLineSegmentsBuffer = [CGPoint](count: 2, repeatedValue: CGPoint())

/// Draws the Legend-form at the given position with the color at the given index.
internal func drawForm(context: CGContext, x: CGFloat, y: CGFloat, colorIndex: Int, legend: ChartLegend)
internal func drawForm(context: CGContext?, x: CGFloat, y: CGFloat, colorIndex: Int, legend: ChartLegend)
{
let formColor = legend.colors[colorIndex]

Expand Down Expand Up @@ -405,7 +405,7 @@ public class ChartLegendRenderer: ChartRendererBase
}

/// Draws the provided label at the given position.
internal func drawLabel(context: CGContext, x: CGFloat, y: CGFloat, label: String, font: UIFont, textColor: UIColor)
internal func drawLabel(context: CGContext?, x: CGFloat, y: CGFloat, label: String, font: UIFont, textColor: UIColor)
{
ChartUtils.drawText(context: context, text: label, point: CGPoint(x: x, y: y), align: .Left, attributes: [NSFontAttributeName: font, NSForegroundColorAttributeName: textColor])
}
Expand Down
10 changes: 5 additions & 5 deletions Charts/Classes/Renderers/ChartXAxisRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class ChartXAxisRenderer: ChartAxisRendererBase
_xAxis.values = xValues
}

public override func renderAxisLabels(context context: CGContext)
public override func renderAxisLabels(context context: CGContext?)
{
if (!_xAxis.isEnabled || !_xAxis.isDrawLabelsEnabled)
{
Expand Down Expand Up @@ -78,7 +78,7 @@ public class ChartXAxisRenderer: ChartAxisRendererBase

private var _axisLineSegmentsBuffer = [CGPoint](count: 2, repeatedValue: CGPoint())

public override func renderAxisLine(context context: CGContext)
public override func renderAxisLine(context context: CGContext?)
{
if (!_xAxis.isEnabled || !_xAxis.isDrawAxisLineEnabled)
{
Expand Down Expand Up @@ -124,7 +124,7 @@ public class ChartXAxisRenderer: ChartAxisRendererBase
}

/// draws the x-labels on the specified y-position
internal func drawLabels(context context: CGContext, pos: CGFloat)
internal func drawLabels(context context: CGContext?, pos: CGFloat)
{
let paraStyle = NSParagraphStyle.defaultParagraphStyle().mutableCopy() as! NSMutableParagraphStyle
paraStyle.alignment = .Center
Expand Down Expand Up @@ -187,7 +187,7 @@ public class ChartXAxisRenderer: ChartAxisRendererBase

private var _gridLineSegmentsBuffer = [CGPoint](count: 2, repeatedValue: CGPoint())

public override func renderGridLines(context context: CGContext)
public override func renderGridLines(context context: CGContext?)
{
if (!_xAxis.isDrawGridLinesEnabled || !_xAxis.isEnabled)
{
Expand Down Expand Up @@ -233,7 +233,7 @@ public class ChartXAxisRenderer: ChartAxisRendererBase

private var _limitLineSegmentsBuffer = [CGPoint](count: 2, repeatedValue: CGPoint())

public override func renderLimitLines(context context: CGContext)
public override func renderLimitLines(context context: CGContext?)
{
var limitLines = _xAxis.limitLines

Expand Down
Loading

0 comments on commit 0ba2102

Please sign in to comment.