Skip to content

Commit

Permalink
just fix all Xcode beta 4 complains, except for Realm bug
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxuan30 committed Aug 5, 2016
1 parent c9ac170 commit 8046b98
Show file tree
Hide file tree
Showing 26 changed files with 197 additions and 169 deletions.
15 changes: 14 additions & 1 deletion Charts/Charts.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -953,14 +953,15 @@
attributes = {
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0710;
LastUpgradeCheck = 0730;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = dcg;
TargetAttributes = {
06AEE7A11BDC3F8B009875AE = {
CreatedOnToolsVersion = 7.1;
};
5BA8EC3F1A9D14DC00CE82E1 = {
CreatedOnToolsVersion = 6.1.1;
LastSwiftMigration = 0800;
};
65B3F5BE1C7370BE000983D0 = {
CreatedOnToolsVersion = 7.2.1;
Expand Down Expand Up @@ -1437,6 +1438,7 @@
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";
};
name = Release;
};
Expand All @@ -1454,8 +1456,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
Expand All @@ -1464,6 +1468,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 @@ -1501,15 +1506,18 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 1;
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 @@ -1544,6 +1552,7 @@
PRODUCT_NAME = Charts;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -1564,6 +1573,8 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.dcg.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = Charts;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand Down Expand Up @@ -1608,6 +1619,7 @@
PRODUCT_NAME = Charts;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
};
name = Release;
Expand Down Expand Up @@ -1653,6 +1665,7 @@
PRODUCT_NAME = Charts;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand Down
20 changes: 20 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 */
132E0D6C1D54C2000054EE93 /* 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 */,
132E0D6D1D54C2000054EE93 /* 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 */
132E0D6D1D54C2000054EE93 /* ChartsRealm.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = ChartsRealm.framework;
remoteRef = 132E0D6C1D54C2000054EE93 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
5B8E087E1C635B5200438BAF /* Charts.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
Expand Down Expand Up @@ -808,6 +824,7 @@
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand Down Expand Up @@ -850,6 +867,7 @@
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
Expand Down Expand Up @@ -882,6 +900,7 @@
PRODUCT_NAME = ChartsDemo;
SWIFT_OBJC_BRIDGING_HEADER = "Supporting Files/ChartsDemo-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -898,6 +917,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.dcg.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = ChartsDemo;
SWIFT_OBJC_BRIDGING_HEADER = "Supporting Files/ChartsDemo-Bridging-Header.h";
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand Down
64 changes: 28 additions & 36 deletions ChartsDemo/Classes/Components/BalloonMarker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ public class BalloonMarker: ChartMarker
self.font = font
self.insets = insets

_paragraphStyle = NSParagraphStyle.defaultParagraphStyle().mutableCopy() as? NSMutableParagraphStyle
_paragraphStyle?.alignment = .Center
_paragraphStyle = NSParagraphStyle.default.mutableCopy() as? NSMutableParagraphStyle
_paragraphStyle?.alignment = .center
}

public override var size: CGSize { return _size; }

public override func draw(context context: CGContext, point: CGPoint)
public override func draw(context: CGContext, point: CGPoint)
{
if (labelns == nil)
{
Expand All @@ -60,49 +60,41 @@ public class BalloonMarker: ChartMarker
rect.origin.x -= _size.width / 2.0
rect.origin.y -= _size.height

CGContextSaveGState(context)
context.saveGState()

CGContextSetFillColorWithColor(context, color?.CGColor)
CGContextBeginPath(context)
CGContextMoveToPoint(context,
rect.origin.x,
rect.origin.y)
CGContextAddLineToPoint(context,
rect.origin.x + rect.size.width,
rect.origin.y)
CGContextAddLineToPoint(context,
rect.origin.x + rect.size.width,
rect.origin.y + rect.size.height - arrowSize.height)
CGContextAddLineToPoint(context,
rect.origin.x + (rect.size.width + arrowSize.width) / 2.0,
rect.origin.y + rect.size.height - arrowSize.height)
CGContextAddLineToPoint(context,
rect.origin.x + rect.size.width / 2.0,
rect.origin.y + rect.size.height)
CGContextAddLineToPoint(context,
rect.origin.x + (rect.size.width - arrowSize.width) / 2.0,
rect.origin.y + rect.size.height - arrowSize.height)
CGContextAddLineToPoint(context,
rect.origin.x,
rect.origin.y + rect.size.height - arrowSize.height)
CGContextAddLineToPoint(context,
rect.origin.x,
rect.origin.y)
CGContextFillPath(context)
context.setFillColor((color?.cgColor)!)
context.beginPath()
context.moveTo(x: rect.origin.x,
y: rect.origin.y)
context.addLineTo(x: rect.origin.x + rect.size.width,
y: rect.origin.y)
context.addLineTo(x: rect.origin.x + rect.size.width,
y: rect.origin.y + rect.size.height - arrowSize.height)
context.addLineTo(x: rect.origin.x + (rect.size.width + arrowSize.width) / 2.0,
y: rect.origin.y + rect.size.height - arrowSize.height)
context.addLineTo(x: rect.origin.x + rect.size.width / 2.0,
y: rect.origin.y + rect.size.height)
context.addLineTo(x: rect.origin.x + (rect.size.width - arrowSize.width) / 2.0,
y: rect.origin.y + rect.size.height - arrowSize.height)
context.addLineTo(x: rect.origin.x,
y: rect.origin.y + rect.size.height - arrowSize.height)
context.addLineTo(x: rect.origin.x,
y: rect.origin.y)
context.fillPath()

rect.origin.y += self.insets.top
rect.size.height -= self.insets.top + self.insets.bottom

UIGraphicsPushContext(context)

labelns?.drawInRect(rect, withAttributes: _drawAttributes)
labelns?.draw(in: rect, withAttributes: _drawAttributes)

UIGraphicsPopContext()

CGContextRestoreGState(context)
context.restoreGState()
}

public override func refreshContent(entry entry: ChartDataEntry, highlight: ChartHighlight)
public override func refreshContent(entry: ChartDataEntry, highlight: ChartHighlight)
{
let label = entry.value.description
labelns = label as NSString
Expand All @@ -111,10 +103,10 @@ public class BalloonMarker: ChartMarker
_drawAttributes[NSFontAttributeName] = self.font
_drawAttributes[NSParagraphStyleAttributeName] = _paragraphStyle

_labelSize = labelns?.sizeWithAttributes(_drawAttributes) ?? CGSizeZero
_labelSize = labelns?.size(attributes: _drawAttributes) ?? CGSize.zero
_size.width = _labelSize.width + self.insets.left + self.insets.right
_size.height = _labelSize.height + self.insets.top + self.insets.bottom
_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 = 3.0;
};
name = Debug;
};
Expand All @@ -760,6 +762,7 @@
PRODUCT_NAME = ChartsRealm;
PROVISIONING_PROFILE = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
};
name = Release;
};
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 = "0730"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "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 = "0730"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "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 = "0730"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
4 changes: 2 additions & 2 deletions ChartsRealm/Classes/Data/RealmBarData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Realm.Dynamic

public class RealmBarData: BarChartData
{
public init(results: RLMResults?, xValueField: String, dataSets: [IChartDataSet]?)
public init(results: RLMResults<RLMObject>?, xValueField: String, dataSets: [IChartDataSet]?)
{
if results == nil
{
Expand All @@ -31,4 +31,4 @@ public class RealmBarData: BarChartData
super.init(xVals: RealmChartUtils.toXVals(results: results!, xValueField: xValueField), dataSets: dataSets)
}
}
}
}
Loading

0 comments on commit 8046b98

Please sign in to comment.