Skip to content

Commit

Permalink
Update for Swift 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Peterson committed Sep 26, 2017
1 parent 2e3e7a3 commit b13c6c4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Classes/Drawing/ReferenceLineDrawingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ internal class ReferenceLineDrawingView : UIView {
}

private func boundingSize(forText text: String) -> CGSize {
return (text as NSString).size(attributes: [NSFontAttributeName:self.settings.referenceLineLabelFont])
return (text as NSString).size(withAttributes: [NSAttributedStringKey.font:self.settings.referenceLineLabelFont])
}

private func calculateYAxisValue(for point: CGPoint) -> Double {
Expand Down
21 changes: 18 additions & 3 deletions graphview_example_code/GraphView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,11 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0900;
TargetAttributes = {
2918399D1C72E6A400753A45 = {
CreatedOnToolsVersion = 7.2.1;
DevelopmentTeam = JN7MAJGLHD;
LastSwiftMigration = 0800;
};
};
Expand Down Expand Up @@ -304,14 +305,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
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_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -350,14 +357,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
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_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -388,12 +401,13 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = JN7MAJGLHD;
INFOPLIST_FILE = GraphView/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ios.GraphView;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -403,12 +417,13 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = JN7MAJGLHD;
INFOPLIST_FILE = GraphView/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ios.GraphView;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extension UIColor {

// Remove the leading "#"
if(hexString[hexString.startIndex] == "#") {
cleanedHexString = hexString.substring(from: hexString.characters.index(hexString.startIndex, offsetBy: 1))
cleanedHexString = String(hexString[hexString.characters.index(hexString.startIndex, offsetBy: 1)...])
}

// TODO: Other cleanup. Allow for a "short" hex string, i.e., "#fff"
Expand Down
4 changes: 2 additions & 2 deletions graphview_example_code/GraphView/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ class ViewController: UIViewController, ScrollableGraphViewDataSource {

// Button tap events

func didTap(_ gesture: UITapGestureRecognizer) {
@objc func didTap(_ gesture: UITapGestureRecognizer) {

currentGraphType.next()

Expand Down Expand Up @@ -553,7 +553,7 @@ class ViewController: UIViewController, ScrollableGraphViewDataSource {
setupConstraints()
}

func reloadDidTap(_ gesture: UITapGestureRecognizer) {
@objc func reloadDidTap(_ gesture: UITapGestureRecognizer) {

// TODO: Currently changing the number of data items is not supported.
// It is only possible to change the the actual values of the data before reloading.
Expand Down

0 comments on commit b13c6c4

Please sign in to comment.