Skip to content

Commit

Permalink
Merge pull request #386 from danielgindi/swift-2.0
Browse files Browse the repository at this point in the history
Swift 2.0 (Fixes #380, fixes #358, fixes #354, fixes #344)
  • Loading branch information
danielgindi committed Sep 18, 2015
2 parents fc0d31d + 326597e commit da0877b
Show file tree
Hide file tree
Showing 70 changed files with 1,519 additions and 1,434 deletions.
17 changes: 15 additions & 2 deletions 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 @@ -417,7 +423,9 @@
5BA8EC371A9D14DC00CE82E1 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0610;
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700;
ORGANIZATIONNAME = dcg;
TargetAttributes = {
5BA8EC3F1A9D14DC00CE82E1 = {
Expand Down Expand Up @@ -501,6 +509,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 @@ -521,6 +530,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 Expand Up @@ -565,6 +575,7 @@
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
Expand Down Expand Up @@ -639,6 +650,7 @@
INFOPLIST_FILE = "Supporting Files/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.dcg.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
Expand All @@ -654,6 +666,7 @@
INFOPLIST_FILE = "Supporting Files/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.dcg.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0610"
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -52,6 +52,8 @@
ReferencedContainer = "container:Charts.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
Expand All @@ -61,6 +63,7 @@
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
Expand Down
104 changes: 52 additions & 52 deletions Charts/Classes/Animation/ChartAnimator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ public class ChartAnimator: NSObject

private func updateAnimationPhases(currentTime: NSTimeInterval)
{
var elapsedTime: NSTimeInterval = currentTime - _startTime
let elapsedTime: NSTimeInterval = currentTime - _startTime
if (_enabledX)
{
var duration: NSTimeInterval = _xDuration
let duration: NSTimeInterval = _xDuration
var elapsed: NSTimeInterval = elapsedTime
if (elapsed > duration)
{
Expand All @@ -106,7 +106,7 @@ public class ChartAnimator: NSObject
}
if (_enabledY)
{
var duration: NSTimeInterval = _yDuration
let duration: NSTimeInterval = _yDuration
var elapsed: NSTimeInterval = elapsedTime
if (elapsed > duration)
{
Expand All @@ -126,7 +126,7 @@ public class ChartAnimator: NSObject

@objc private func animationLoop()
{
var currentTime: NSTimeInterval = CACurrentMediaTime()
let currentTime: NSTimeInterval = CACurrentMediaTime()

updateAnimationPhases(currentTime)

Expand All @@ -146,12 +146,12 @@ public class ChartAnimator: NSObject
}

/// Animates the drawing / rendering of the chart on both x- and y-axis with the specified animation time.
/// If animate(...) is called, no further calling of invalidate() is necessary to refresh the chart.
/// :param: xAxisDuration duration for animating the x axis
/// :param: yAxisDuration duration for animating the y axis
/// :param: easingX an easing function for the animation on the x axis
/// :param: easingY an easing function for the animation on the y axis
public func animate(#xAxisDuration: NSTimeInterval, yAxisDuration: NSTimeInterval, easingX: ChartEasingFunctionBlock?, easingY: ChartEasingFunctionBlock?)
/// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart.
/// - parameter xAxisDuration: duration for animating the x axis
/// - parameter yAxisDuration: duration for animating the y axis
/// - parameter easingX: an easing function for the animation on the x axis
/// - parameter easingY: an easing function for the animation on the y axis
public func animate(xAxisDuration xAxisDuration: NSTimeInterval, yAxisDuration: NSTimeInterval, easingX: ChartEasingFunctionBlock?, easingY: ChartEasingFunctionBlock?)
{
stop()

Expand Down Expand Up @@ -179,93 +179,93 @@ public class ChartAnimator: NSObject
}

/// Animates the drawing / rendering of the chart on both x- and y-axis with the specified animation time.
/// If animate(...) is called, no further calling of invalidate() is necessary to refresh the chart.
/// :param: xAxisDuration duration for animating the x axis
/// :param: yAxisDuration duration for animating the y axis
/// :param: easingOptionX the easing function for the animation on the x axis
/// :param: easingOptionY the easing function for the animation on the y axis
public func animate(#xAxisDuration: NSTimeInterval, yAxisDuration: NSTimeInterval, easingOptionX: ChartEasingOption, easingOptionY: ChartEasingOption)
/// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart.
/// - parameter xAxisDuration: duration for animating the x axis
/// - parameter yAxisDuration: duration for animating the y axis
/// - parameter easingOptionX: the easing function for the animation on the x axis
/// - parameter easingOptionY: the easing function for the animation on the y axis
public func animate(xAxisDuration xAxisDuration: NSTimeInterval, yAxisDuration: NSTimeInterval, easingOptionX: ChartEasingOption, easingOptionY: ChartEasingOption)
{
animate(xAxisDuration: xAxisDuration, yAxisDuration: yAxisDuration, easingX: easingFunctionFromOption(easingOptionX), easingY: easingFunctionFromOption(easingOptionY))
}

/// Animates the drawing / rendering of the chart on both x- and y-axis with the specified animation time.
/// If animate(...) is called, no further calling of invalidate() is necessary to refresh the chart.
/// :param: xAxisDuration duration for animating the x axis
/// :param: yAxisDuration duration for animating the y axis
/// :param: easing an easing function for the animation
public func animate(#xAxisDuration: NSTimeInterval, yAxisDuration: NSTimeInterval, easing: ChartEasingFunctionBlock?)
/// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart.
/// - parameter xAxisDuration: duration for animating the x axis
/// - parameter yAxisDuration: duration for animating the y axis
/// - parameter easing: an easing function for the animation
public func animate(xAxisDuration xAxisDuration: NSTimeInterval, yAxisDuration: NSTimeInterval, easing: ChartEasingFunctionBlock?)
{
animate(xAxisDuration: xAxisDuration, yAxisDuration: yAxisDuration, easingX: easing, easingY: easing)
}

/// Animates the drawing / rendering of the chart on both x- and y-axis with the specified animation time.
/// If animate(...) is called, no further calling of invalidate() is necessary to refresh the chart.
/// :param: xAxisDuration duration for animating the x axis
/// :param: yAxisDuration duration for animating the y axis
/// :param: easingOption the easing function for the animation
public func animate(#xAxisDuration: NSTimeInterval, yAxisDuration: NSTimeInterval, easingOption: ChartEasingOption)
/// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart.
/// - parameter xAxisDuration: duration for animating the x axis
/// - parameter yAxisDuration: duration for animating the y axis
/// - parameter easingOption: the easing function for the animation
public func animate(xAxisDuration xAxisDuration: NSTimeInterval, yAxisDuration: NSTimeInterval, easingOption: ChartEasingOption)
{
animate(xAxisDuration: xAxisDuration, yAxisDuration: yAxisDuration, easing: easingFunctionFromOption(easingOption))
}

/// Animates the drawing / rendering of the chart on both x- and y-axis with the specified animation time.
/// If animate(...) is called, no further calling of invalidate() is necessary to refresh the chart.
/// :param: xAxisDuration duration for animating the x axis
/// :param: yAxisDuration duration for animating the y axis
public func animate(#xAxisDuration: NSTimeInterval, yAxisDuration: NSTimeInterval)
/// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart.
/// - parameter xAxisDuration: duration for animating the x axis
/// - parameter yAxisDuration: duration for animating the y axis
public func animate(xAxisDuration xAxisDuration: NSTimeInterval, yAxisDuration: NSTimeInterval)
{
animate(xAxisDuration: xAxisDuration, yAxisDuration: yAxisDuration, easingOption: .EaseInOutSine)
}

/// Animates the drawing / rendering of the chart the x-axis with the specified animation time.
/// If animate(...) is called, no further calling of invalidate() is necessary to refresh the chart.
/// :param: xAxisDuration duration for animating the x axis
/// :param: easing an easing function for the animation
public func animate(#xAxisDuration: NSTimeInterval, easing: ChartEasingFunctionBlock?)
/// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart.
/// - parameter xAxisDuration: duration for animating the x axis
/// - parameter easing: an easing function for the animation
public func animate(xAxisDuration xAxisDuration: NSTimeInterval, easing: ChartEasingFunctionBlock?)
{
animate(xAxisDuration: xAxisDuration, yAxisDuration: 0.0, easing: easing)
}

/// Animates the drawing / rendering of the chart the x-axis with the specified animation time.
/// If animate(...) is called, no further calling of invalidate() is necessary to refresh the chart.
/// :param: xAxisDuration duration for animating the x axis
/// :param: easingOption the easing function for the animation
public func animate(#xAxisDuration: NSTimeInterval, easingOption: ChartEasingOption)
/// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart.
/// - parameter xAxisDuration: duration for animating the x axis
/// - parameter easingOption: the easing function for the animation
public func animate(xAxisDuration xAxisDuration: NSTimeInterval, easingOption: ChartEasingOption)
{
animate(xAxisDuration: xAxisDuration, yAxisDuration: 0.0, easing: easingFunctionFromOption(easingOption))
}

/// Animates the drawing / rendering of the chart the x-axis with the specified animation time.
/// If animate(...) is called, no further calling of invalidate() is necessary to refresh the chart.
/// :param: xAxisDuration duration for animating the x axis
public func animate(#xAxisDuration: NSTimeInterval)
/// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart.
/// - parameter xAxisDuration: duration for animating the x axis
public func animate(xAxisDuration xAxisDuration: NSTimeInterval)
{
animate(xAxisDuration: xAxisDuration, yAxisDuration: 0.0, easingOption: .EaseInOutSine)
}

/// Animates the drawing / rendering of the chart the y-axis with the specified animation time.
/// If animate(...) is called, no further calling of invalidate() is necessary to refresh the chart.
/// :param: yAxisDuration duration for animating the y axis
/// :param: easing an easing function for the animation
public func animate(#yAxisDuration: NSTimeInterval, easing: ChartEasingFunctionBlock?)
/// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart.
/// - parameter yAxisDuration: duration for animating the y axis
/// - parameter easing: an easing function for the animation
public func animate(yAxisDuration yAxisDuration: NSTimeInterval, easing: ChartEasingFunctionBlock?)
{
animate(xAxisDuration: 0.0, yAxisDuration: yAxisDuration, easing: easing)
}

/// Animates the drawing / rendering of the chart the y-axis with the specified animation time.
/// If animate(...) is called, no further calling of invalidate() is necessary to refresh the chart.
/// :param: yAxisDuration duration for animating the y axis
/// :param: easingOption the easing function for the animation
public func animate(#yAxisDuration: NSTimeInterval, easingOption: ChartEasingOption)
/// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart.
/// - parameter yAxisDuration: duration for animating the y axis
/// - parameter easingOption: the easing function for the animation
public func animate(yAxisDuration yAxisDuration: NSTimeInterval, easingOption: ChartEasingOption)
{
animate(xAxisDuration: 0.0, yAxisDuration: yAxisDuration, easing: easingFunctionFromOption(easingOption))
}

/// Animates the drawing / rendering of the chart the y-axis with the specified animation time.
/// If animate(...) is called, no further calling of invalidate() is necessary to refresh the chart.
/// :param: yAxisDuration duration for animating the y axis
public func animate(#yAxisDuration: NSTimeInterval)
/// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart.
/// - parameter yAxisDuration: duration for animating the y axis
public func animate(yAxisDuration yAxisDuration: NSTimeInterval)
{
animate(xAxisDuration: 0.0, yAxisDuration: yAxisDuration, easingOption: .EaseInOutSine)
}
Expand Down
Loading

0 comments on commit da0877b

Please sign in to comment.