Skip to content

Commit

Permalink
Merge pull request #1163 from liuxuan30/swift-2.3
Browse files Browse the repository at this point in the history
Swift 2.3
  • Loading branch information
liuxuan30 committed Jun 21, 2016
2 parents ee23f8c + 75931fd commit 80cd0f8
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 20 deletions.
6 changes: 6 additions & 0 deletions Charts/Charts.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -961,9 +961,11 @@
};
5BA8EC3F1A9D14DC00CE82E1 = {
CreatedOnToolsVersion = 6.1.1;
LastSwiftMigration = 0800;
};
65B3F5BE1C7370BE000983D0 = {
CreatedOnToolsVersion = 7.2.1;
LastSwiftMigration = 0800;
};
A52C5C361BAC5CA400594CDD = {
CreatedOnToolsVersion = 7.1;
Expand Down Expand Up @@ -1543,6 +1545,7 @@
PRODUCT_NAME = Charts;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 2.3;
};
name = Debug;
};
Expand All @@ -1563,6 +1566,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.dcg.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = Charts;
SKIP_INSTALL = YES;
SWIFT_VERSION = 2.3;
};
name = Release;
};
Expand All @@ -1584,6 +1588,7 @@
PRODUCT_NAME = Charts;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 2.3;
};
name = Debug;
};
Expand All @@ -1606,6 +1611,7 @@
PRODUCT_NAME = Charts;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 2.3;
};
name = Release;
};
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)
}

}
}
10 changes: 5 additions & 5 deletions Charts/Classes/Utils/ChartPlatform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 Expand Up @@ -550,8 +550,8 @@ types are aliased to either their UI* implementation (on iOS) or their NS* imple

let colorSpace = CGColorSpaceCreateDeviceRGB()
let ctx = CGBitmapContextCreate(nil, width, height, 8, 4*width, colorSpace, (opaque ? CGImageAlphaInfo.NoneSkipFirst.rawValue : CGImageAlphaInfo.PremultipliedFirst.rawValue))
CGContextConcatCTM(ctx, CGAffineTransformMake(1, 0, 0, -1, 0, CGFloat(height)))
CGContextScaleCTM(ctx, scale, scale)
CGContextConcatCTM(ctx!, CGAffineTransformMake(1, 0, 0, -1, 0, CGFloat(height)))
CGContextScaleCTM(ctx!, scale, scale)
NSUIGraphicsPushContext(ctx!)
}
}
Expand All @@ -562,9 +562,9 @@ types are aliased to either their UI* implementation (on iOS) or their NS* imple
{
let ctx = NSUIGraphicsGetCurrentContext()
let scale = imageContextStack.last!
if let theCGImage = CGBitmapContextCreateImage(ctx)
if let theCGImage = CGBitmapContextCreateImage(ctx!)
{
let size = CGSizeMake(CGFloat(CGBitmapContextGetWidth(ctx)) / scale, CGFloat(CGBitmapContextGetHeight(ctx)) / scale)
let size = CGSizeMake(CGFloat(CGBitmapContextGetWidth(ctx!)) / scale, CGFloat(CGBitmapContextGetHeight(ctx!)) / scale)
let image = NSImage(CGImage: theCGImage, size: size)
return image
}
Expand Down
18 changes: 18 additions & 0 deletions ChartsDemo/ChartsDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
136083331D10AAC200D57921 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 5B8E088D1C635B6D00438BAF /* ChartsRealm.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 5BA899431CADB7F20012ED64;
remoteInfo = "ChartsRealm-OSX";
};
5B8E087D1C635B5200438BAF /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 5B8E08771C635B5200438BAF /* Charts.xcodeproj */;
Expand Down Expand Up @@ -413,6 +420,7 @@
children = (
5B8E08941C635B6D00438BAF /* ChartsRealm.framework */,
5B8E08961C635B6D00438BAF /* ChartsRealm.framework */,
136083341D10AAC200D57921 /* ChartsRealm.framework */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -597,6 +605,7 @@
TargetAttributes = {
5B57BBAE1A9B26AA0036A6CC = {
CreatedOnToolsVersion = 6.1.1;
LastSwiftMigration = 0800;
};
};
};
Expand Down Expand Up @@ -629,6 +638,13 @@
/* End PBXProject section */

/* Begin PBXReferenceProxy section */
136083341D10AAC200D57921 /* ChartsRealm.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = ChartsRealm.framework;
remoteRef = 136083331D10AAC200D57921 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
5B8E087E1C635B5200438BAF /* Charts.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
Expand Down Expand Up @@ -882,6 +898,7 @@
PRODUCT_NAME = ChartsDemo;
SWIFT_OBJC_BRIDGING_HEADER = "Supporting Files/ChartsDemo-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 2.3;
};
name = Debug;
};
Expand All @@ -898,6 +915,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.dcg.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = ChartsDemo;
SWIFT_OBJC_BRIDGING_HEADER = "Supporting Files/ChartsDemo-Bridging-Header.h";
SWIFT_VERSION = 2.3;
};
name = Release;
};
Expand Down
4 changes: 2 additions & 2 deletions ChartsDemo/Classes/Components/BalloonMarker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class BalloonMarker: ChartMarker

CGContextSaveGState(context)

CGContextSetFillColorWithColor(context, color?.CGColor)
CGContextSetFillColorWithColor(context, (color?.CGColor)!)
CGContextBeginPath(context)
CGContextMoveToPoint(context,
rect.origin.x,
Expand Down Expand Up @@ -117,4 +117,4 @@ public class BalloonMarker: ChartMarker
_size.width = max(minimumSize.width, _size.width)
_size.height = max(minimumSize.height, _size.height)
}
}
}
3 changes: 3 additions & 0 deletions ChartsRealm/ChartsRealm.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@
5BA8EC3F1A9D14DC00CE82E1 = {
CreatedOnToolsVersion = 6.1.1;
DevelopmentTeam = EF7AZ55H5Q;
LastSwiftMigration = 0800;
};
A52C5C361BAC5CA400594CDD = {
CreatedOnToolsVersion = 7.1;
Expand Down Expand Up @@ -736,6 +737,7 @@
PROVISIONING_PROFILE = "";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 2.3;
};
name = Debug;
};
Expand All @@ -760,6 +762,7 @@
PRODUCT_NAME = ChartsRealm;
PROVISIONING_PROFILE = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 2.3;
};
name = Release;
};
Expand Down

0 comments on commit 80cd0f8

Please sign in to comment.