From 8e94738aee63c08c69c02d470c4f3393e2b1c48f Mon Sep 17 00:00:00 2001 From: Madhava Jay Date: Wed, 3 Apr 2019 16:07:06 +1100 Subject: [PATCH] Updated to compile with Swift 5 and Xcode 10.2 --- Classes/ZFRippleButton.swift | 12 ++--- .../project.pbxproj | 44 ++++++++++++++++--- .../ZFRippleButtonDemo/AppDelegate.swift | 2 +- .../ZFRippleButtonDemo/Info.plist | 2 +- .../ZFRippleButtonDemoTests/Info.plist | 2 +- 5 files changed, 47 insertions(+), 15 deletions(-) diff --git a/Classes/ZFRippleButton.swift b/Classes/ZFRippleButton.swift index 33adcfa..5337754 100755 --- a/Classes/ZFRippleButton.swift +++ b/Classes/ZFRippleButton.swift @@ -108,14 +108,14 @@ open class ZFRippleButton: UIButton { touchCenterLocation = nil } - UIView.animate(withDuration: 0.1, delay: 0, options: UIViewAnimationOptions.allowUserInteraction, animations: { + UIView.animate(withDuration: 0.1, delay: 0, options: UIView.AnimationOptions.allowUserInteraction, animations: { self.rippleBackgroundView.alpha = 1 }, completion: nil) rippleView.transform = CGAffineTransform(scaleX: 0.5, y: 0.5) - UIView.animate(withDuration: 0.7, delay: 0, options: [UIViewAnimationOptions.curveEaseOut, UIViewAnimationOptions.allowUserInteraction], + UIView.animate(withDuration: 0.7, delay: 0, options: [UIView.AnimationOptions.curveEaseOut, UIView.AnimationOptions.allowUserInteraction], animations: { self.rippleView.transform = CGAffineTransform.identity }, completion: nil) @@ -132,7 +132,7 @@ open class ZFRippleButton: UIButton { let groupAnim = CAAnimationGroup() groupAnim.duration = 0.7 - groupAnim.fillMode = kCAFillModeForwards + groupAnim.fillMode = CAMediaTimingFillMode.forwards groupAnim.isRemovedOnCompletion = false groupAnim.animations = [shadowAnim, opacityAnim] @@ -152,10 +152,10 @@ open class ZFRippleButton: UIButton { } fileprivate func animateToNormal() { - UIView.animate(withDuration: 0.1, delay: 0, options: UIViewAnimationOptions.allowUserInteraction, animations: { + UIView.animate(withDuration: 0.1, delay: 0, options: UIView.AnimationOptions.allowUserInteraction, animations: { self.rippleBackgroundView.alpha = 1 }, completion: {(success: Bool) -> () in - UIView.animate(withDuration: self.touchUpAnimationTime, delay: 0, options: UIViewAnimationOptions.allowUserInteraction, animations: { + UIView.animate(withDuration: self.touchUpAnimationTime, delay: 0, options: UIView.AnimationOptions.allowUserInteraction, animations: { self.rippleBackgroundView.alpha = 0 }, completion: nil) }) @@ -174,7 +174,7 @@ open class ZFRippleButton: UIButton { let groupAnim = CAAnimationGroup() groupAnim.duration = 0.7 - groupAnim.fillMode = kCAFillModeForwards + groupAnim.fillMode = CAMediaTimingFillMode.forwards groupAnim.isRemovedOnCompletion = false groupAnim.animations = [shadowAnim, opacityAnim] diff --git a/Demo/ZFRippleButtonDemo/ZFRippleButtonDemo.xcodeproj/project.pbxproj b/Demo/ZFRippleButtonDemo/ZFRippleButtonDemo.xcodeproj/project.pbxproj index a842232..4c6e489 100755 --- a/Demo/ZFRippleButtonDemo/ZFRippleButtonDemo.xcodeproj/project.pbxproj +++ b/Demo/ZFRippleButtonDemo/ZFRippleButtonDemo.xcodeproj/project.pbxproj @@ -169,7 +169,7 @@ attributes = { LastSwiftMigration = 0700; LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0600; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = zoonref; TargetAttributes = { DC346CB6195F150E0099F81E = { @@ -185,7 +185,7 @@ }; buildConfigurationList = DC346CB2195F150E0099F81E /* Build configuration list for PBXProject "ZFRippleButtonDemo" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -275,24 +275,37 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 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_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = 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; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + 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", @@ -310,6 +323,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -317,17 +331,28 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 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_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = 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; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -335,6 +360,7 @@ 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; @@ -344,6 +370,8 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; METAL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_VERSION = 5.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -355,8 +383,9 @@ INFOPLIST_FILE = ZFRippleButtonDemo/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.zoonref.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -367,8 +396,9 @@ INFOPLIST_FILE = ZFRippleButtonDemo/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.zoonref.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -387,8 +417,9 @@ INFOPLIST_FILE = ZFRippleButtonDemoTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.zoonref.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUNDLE_LOADER)"; }; name = Debug; @@ -404,8 +435,9 @@ INFOPLIST_FILE = ZFRippleButtonDemoTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = "com.zoonref.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUNDLE_LOADER)"; }; name = Release; diff --git a/Demo/ZFRippleButtonDemo/ZFRippleButtonDemo/AppDelegate.swift b/Demo/ZFRippleButtonDemo/ZFRippleButtonDemo/AppDelegate.swift index 7bd6405..3dbc32b 100755 --- a/Demo/ZFRippleButtonDemo/ZFRippleButtonDemo/AppDelegate.swift +++ b/Demo/ZFRippleButtonDemo/ZFRippleButtonDemo/AppDelegate.swift @@ -13,7 +13,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } diff --git a/Demo/ZFRippleButtonDemo/ZFRippleButtonDemo/Info.plist b/Demo/ZFRippleButtonDemo/ZFRippleButtonDemo/Info.plist index c0e7529..5936a9d 100755 --- a/Demo/ZFRippleButtonDemo/ZFRippleButtonDemo/Info.plist +++ b/Demo/ZFRippleButtonDemo/ZFRippleButtonDemo/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.zoonref.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/Demo/ZFRippleButtonDemo/ZFRippleButtonDemoTests/Info.plist b/Demo/ZFRippleButtonDemo/ZFRippleButtonDemoTests/Info.plist index afeca19..6d32c15 100755 --- a/Demo/ZFRippleButtonDemo/ZFRippleButtonDemoTests/Info.plist +++ b/Demo/ZFRippleButtonDemo/ZFRippleButtonDemoTests/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.zoonref.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName