Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Charts changes for Swift 2.3 #1145

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Charts/Charts.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.pierremarcairoldi.ChartsTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 2.3;
};
name = Debug;
};
Expand All @@ -1436,6 +1437,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.pierremarcairoldi.ChartsTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 2.3;
};
name = Release;
};
Expand Down Expand Up @@ -1463,6 +1466,7 @@
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
Expand Down Expand Up @@ -1509,6 +1513,7 @@
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
Expand Down Expand Up @@ -1543,6 +1548,7 @@
PRODUCT_NAME = Charts;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 2.3;
};
name = Debug;
};
Expand All @@ -1563,6 +1569,8 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.dcg.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = Charts;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 2.3;
};
name = Release;
};
Expand Down Expand Up @@ -1606,6 +1614,7 @@
PRODUCT_NAME = Charts;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
};
name = Release;
};
Expand Down Expand Up @@ -1650,6 +1659,7 @@
PRODUCT_NAME = Charts;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
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 @@ -814,13 +814,13 @@ public class ChartViewBase: NSUIView, ChartDataProvider, ChartAnimatorDelegate
if (opaque || !transparent)
{
// Background color may be partially transparent, we must fill with white if we want to output an opaque image
CGContextSetFillColorWithColor(context, NSUIColor.whiteColor().CGColor)
CGContextFillRect(context, rect)
CGContextSetFillColorWithColor(context!, NSUIColor.whiteColor().CGColor)
CGContextFillRect(context!, rect)

if (self.backgroundColor !== nil)
{
CGContextSetFillColorWithColor(context, self.backgroundColor?.CGColor)
CGContextFillRect(context, rect)
CGContextSetFillColorWithColor(context!, (self.backgroundColor?.CGColor)!)
CGContextFillRect(context!, rect)
}
}

Expand Down
4 changes: 2 additions & 2 deletions Charts/Classes/Renderers/ScatterChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public class ScatterChartRenderer: LineScatterCandleRadarChartRenderer
CGContextTranslateCTM(context, point.x, point.y)

CGContextBeginPath(context)
CGContextAddPath(context, customShape)
CGContextAddPath(context, customShape!)
CGContextFillPath(context)

CGContextRestoreGState(context)
Expand Down Expand Up @@ -410,4 +410,4 @@ public class ScatterChartRenderer: LineScatterCandleRadarChartRenderer

CGContextRestoreGState(context)
}
}
}
14 changes: 7 additions & 7 deletions Charts/Classes/Utils/ChartFill.swift
Original file line number Diff line number Diff line change
Expand Up @@ -260,23 +260,23 @@ public class ChartFill: NSObject
{
case .Color:

CGContextSetFillColorWithColor(context, _color)
CGContextSetFillColorWithColor(context, _color!)
CGContextFillPath(context)

case .Image:

CGContextClip(context)
CGContextDrawImage(context, rect, _image)
CGContextDrawImage(context, rect, _image!)

case .TiledImage:

CGContextClip(context)
CGContextDrawTiledImage(context, rect, _image)
CGContextDrawTiledImage(context, rect, _image!)

case .Layer:

CGContextClip(context)
CGContextDrawLayerInRect(context, rect, _layer)
CGContextDrawLayerInRect(context, rect, _layer!)

case .LinearGradient:

Expand All @@ -296,7 +296,7 @@ public class ChartFill: NSObject
CGContextClip(context)
CGContextDrawLinearGradient(
context,
_gradient,
_gradient!,
startPoint,
endPoint,
[.DrawsAfterEndLocation, .DrawsBeforeStartLocation]
Expand All @@ -310,7 +310,7 @@ public class ChartFill: NSObject
CGContextClip(context)
CGContextDrawRadialGradient(
context,
_gradient,
_gradient!,
CGPointMake(
centerPoint.x + rect.width * _gradientStartOffsetPercent.x,
centerPoint.y + rect.height * _gradientStartOffsetPercent.y
Expand All @@ -331,4 +331,4 @@ public class ChartFill: NSObject
CGContextRestoreGState(context)
}

}
}
4 changes: 2 additions & 2 deletions Charts/Classes/Utils/ChartPlatform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ types are aliased to either their UI* implementation (on iOS) or their NS* imple
self.nsuiTouchesEnded(touches, withEvent: event)
}

public final override func touchesCancelled(touches: Set<NSUITouch>?, withEvent event: NSUIEvent?)
public final override func touchesCancelled(touches: Set<NSUITouch>, withEvent event: NSUIEvent?)
{
self.nsuiTouchesCancelled(touches, withEvent: event)
}
Expand All @@ -130,7 +130,7 @@ types are aliased to either their UI* implementation (on iOS) or their NS* imple

public func nsuiTouchesCancelled(touches: Set<NSUITouch>?, withEvent event: NSUIEvent?)
{
super.touchesCancelled(touches, withEvent: event!)
super.touchesCancelled(touches!, withEvent: event!)
}

var nsuiLayer: CALayer?
Expand Down