From c25fd805056d45d19c10eac5926ca102e8c99147 Mon Sep 17 00:00:00 2001 From: Felix Hedlund Date: Fri, 6 Oct 2017 15:02:34 +0200 Subject: [PATCH] Updated for swift 4 --- .../project.pbxproj | 32 +++++++++++++++---- .../RazzleDazzleDemo/AppDelegate.swift | 3 +- .../RazzleDazzle.xcodeproj/project.pbxproj | 22 ++++++++++--- .../xcschemes/RazzleDazzle.xcscheme | 4 ++- Source/PathPositionAnimation.swift | 2 +- Source/RotationAnimation.swift | 2 +- 6 files changed, 49 insertions(+), 16 deletions(-) diff --git a/Example/Example/RazzleDazzleDemo.xcodeproj/project.pbxproj b/Example/Example/RazzleDazzleDemo.xcodeproj/project.pbxproj index 7fdee18..6b00a06 100644 --- a/Example/Example/RazzleDazzleDemo.xcodeproj/project.pbxproj +++ b/Example/Example/RazzleDazzleDemo.xcodeproj/project.pbxproj @@ -177,17 +177,17 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0900; ORGANIZATIONNAME = IFTTT; TargetAttributes = { FAD1C7471B2F57D60053D880 = { CreatedOnToolsVersion = 6.3.2; DevelopmentTeamName = "Raphael Cruzeiro (Personal Team)"; - LastSwiftMigration = 0800; + LastSwiftMigration = 0900; }; FAD1C75C1B2F57D60053D880 = { CreatedOnToolsVersion = 6.3.2; - LastSwiftMigration = 0800; + LastSwiftMigration = 0900; TestTargetID = FAD1C7471B2F57D60053D880; }; }; @@ -287,14 +287,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; @@ -334,14 +340,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; @@ -371,11 +383,13 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = RazzleDazzleDemo/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "ifttt.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -385,11 +399,13 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = RazzleDazzleDemo/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "ifttt.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -410,7 +426,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "ifttt.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RazzleDazzleDemo.app/RazzleDazzleDemo"; }; name = Debug; @@ -427,7 +444,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "ifttt.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RazzleDazzleDemo.app/RazzleDazzleDemo"; }; name = Release; diff --git a/Example/Example/RazzleDazzleDemo/AppDelegate.swift b/Example/Example/RazzleDazzleDemo/AppDelegate.swift index 7306fd1..593ae61 100644 --- a/Example/Example/RazzleDazzleDemo/AppDelegate.swift +++ b/Example/Example/RazzleDazzleDemo/AppDelegate.swift @@ -13,8 +13,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool { // Override point for customization after application launch. return true } diff --git a/Example/RazzleDazzle.xcodeproj/project.pbxproj b/Example/RazzleDazzle.xcodeproj/project.pbxproj index f8f567f..eb8af99 100644 --- a/Example/RazzleDazzle.xcodeproj/project.pbxproj +++ b/Example/RazzleDazzle.xcodeproj/project.pbxproj @@ -284,12 +284,12 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0900; ORGANIZATIONNAME = IFTTT; TargetAttributes = { FACD9C5C1B2A554100AC1614 = { CreatedOnToolsVersion = 6.3.1; - LastSwiftMigration = 0800; + LastSwiftMigration = 0900; ProvisioningStyle = Automatic; }; FACD9C671B2A554100AC1614 = { @@ -402,14 +402,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; @@ -452,14 +458,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; @@ -506,7 +518,8 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -528,7 +541,8 @@ PRODUCT_BUNDLE_IDENTIFIER = "ifttt.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; }; name = Release; }; diff --git a/Example/RazzleDazzle.xcodeproj/xcshareddata/xcschemes/RazzleDazzle.xcscheme b/Example/RazzleDazzle.xcodeproj/xcshareddata/xcschemes/RazzleDazzle.xcscheme index bd81817..e4f17e4 100644 --- a/Example/RazzleDazzle.xcodeproj/xcshareddata/xcschemes/RazzleDazzle.xcscheme +++ b/Example/RazzleDazzle.xcodeproj/xcshareddata/xcschemes/RazzleDazzle.xcscheme @@ -1,6 +1,6 @@ @@ -70,6 +71,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/Source/PathPositionAnimation.swift b/Source/PathPositionAnimation.swift index b8ee893..0af9866 100644 --- a/Source/PathPositionAnimation.swift +++ b/Source/PathPositionAnimation.swift @@ -52,7 +52,7 @@ public class PathPositionAnimation : Animation, Animatable { return (value >= 0) && (value <= 1) } - @objc private func createKeyframeAnimation() { + @objc func createKeyframeAnimation() { // Set up a CAKeyframeAnimation to move the view along the path view.layer.add(pathAnimation(), forKey: animationKey) view.layer.speed = 0 diff --git a/Source/RotationAnimation.swift b/Source/RotationAnimation.swift index 57e9d4d..096e9b3 100644 --- a/Source/RotationAnimation.swift +++ b/Source/RotationAnimation.swift @@ -21,7 +21,7 @@ public class RotationAnimation : Animation, Animatable { public func animate(_ time: CGFloat) { if !hasKeyframes() {return} let degrees = self[time] - let radians = degrees * CGFloat(M_PI / -180.0) + let radians = degrees * CGFloat(Double.pi / -180.0) let rotationTransform = CGAffineTransform(rotationAngle: radians) view.rotationTransform = rotationTransform var newTransform = rotationTransform