From f46b8961575a7d4c54bb95fcf2fd8ce7044167bb Mon Sep 17 00:00:00 2001 From: Kyle Date: Tue, 3 Oct 2017 12:18:24 -0400 Subject: [PATCH] Ran Swift4 Convert Fixed warning about M_PI deprecation by replacing with Double.pi Updated project settings per Xcode's recommendation @objc Inference set to Default in Build Settings --- DMSwipeCards/Classes/DMSwipeCard.swift | 6 +-- .../DMSwipeCards.xcodeproj/project.pbxproj | 54 +++++++++++++++---- .../xcschemes/DMSwipeCards-Example.xcscheme | 4 +- Example/DMSwipeCards/ViewController.swift | 4 +- 4 files changed, 53 insertions(+), 15 deletions(-) diff --git a/DMSwipeCards/Classes/DMSwipeCard.swift b/DMSwipeCards/Classes/DMSwipeCard.swift index 3c48c6e..97db7e5 100644 --- a/DMSwipeCards/Classes/DMSwipeCard.swift +++ b/DMSwipeCards/Classes/DMSwipeCard.swift @@ -24,7 +24,7 @@ class DMSwipeCard: UIView { private let actionMargin: CGFloat = 120.0 private let rotationStrength: CGFloat = 320.0 - private let rotationAngle: CGFloat = CGFloat(M_PI) / CGFloat(8.0) + private let rotationAngle: CGFloat = CGFloat(Double.pi) / CGFloat(8.0) private let rotationMax: CGFloat = 1 private let scaleStrength: CGFloat = -2 private let scaleMax: CGFloat = 1.02 @@ -61,7 +61,7 @@ class DMSwipeCard: UIView { } } - func dragEvent(gesture: UIPanGestureRecognizer) { + @objc func dragEvent(gesture: UIPanGestureRecognizer) { xFromCenter = gesture.translation(in: self).x yFromCenter = gesture.translation(in: self).y @@ -87,7 +87,7 @@ class DMSwipeCard: UIView { } } - func tapEvent(gesture: UITapGestureRecognizer) { + @objc func tapEvent(gesture: UITapGestureRecognizer) { self.delegate?.cardTapped(self) } diff --git a/Example/DMSwipeCards.xcodeproj/project.pbxproj b/Example/DMSwipeCards.xcodeproj/project.pbxproj index 664737a..fcaba53 100644 --- a/Example/DMSwipeCards.xcodeproj/project.pbxproj +++ b/Example/DMSwipeCards.xcodeproj/project.pbxproj @@ -210,16 +210,18 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0720; + LastUpgradeCheck = 0900; ORGANIZATIONNAME = CocoaPods; TargetAttributes = { 607FACCF1AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; - LastSwiftMigration = 0820; + DevelopmentTeam = U69N6KJ99T; + LastSwiftMigration = 0900; }; 607FACE41AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; - LastSwiftMigration = 0820; + DevelopmentTeam = U69N6KJ99T; + LastSwiftMigration = 0900; TestTargetID = 607FACCF1AFB9204008FA782; }; }; @@ -270,13 +272,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-DMSwipeCards_Example-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; 679E24DDE95367712F71CFC5 /* [CP] Embed Pods Frameworks */ = { @@ -285,9 +290,12 @@ files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-DMSwipeCards_Example/Pods-DMSwipeCards_Example-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/DMSwipeCards/DMSwipeCards.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DMSwipeCards.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -300,13 +308,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-DMSwipeCards_Tests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; BC2B06B9A501516B6782B00E /* [CP] Copy Pods Resources */ = { @@ -412,13 +423,21 @@ 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; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -457,13 +476,21 @@ 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; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -482,6 +509,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.3; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; VALIDATE_PRODUCT = YES; }; name = Release; @@ -491,12 +519,14 @@ baseConfigurationReference = 8D1421C8DEBC15509002FEE1 /* Pods-DMSwipeCards_Example.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = U69N6KJ99T; INFOPLIST_FILE = DMSwipeCards/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -505,12 +535,14 @@ baseConfigurationReference = 79D49D4CA52D2D5FAE0A4FB4 /* Pods-DMSwipeCards_Example.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = U69N6KJ99T; INFOPLIST_FILE = DMSwipeCards/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; }; name = Release; }; @@ -518,6 +550,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = C4D2A18B3C40A0ECA3C6D57A /* Pods-DMSwipeCards_Tests.debug.xcconfig */; buildSettings = { + DEVELOPMENT_TEAM = U69N6KJ99T; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", @@ -530,7 +563,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -538,6 +572,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 6B1B7896F726F29C923F295F /* Pods-DMSwipeCards_Tests.release.xcconfig */; buildSettings = { + DEVELOPMENT_TEAM = U69N6KJ99T; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", @@ -546,7 +581,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; }; name = Release; }; diff --git a/Example/DMSwipeCards.xcodeproj/xcshareddata/xcschemes/DMSwipeCards-Example.xcscheme b/Example/DMSwipeCards.xcodeproj/xcshareddata/xcschemes/DMSwipeCards-Example.xcscheme index 0715ba8..2ddcb0e 100644 --- a/Example/DMSwipeCards.xcodeproj/xcshareddata/xcschemes/DMSwipeCards-Example.xcscheme +++ b/Example/DMSwipeCards.xcodeproj/xcshareddata/xcschemes/DMSwipeCards-Example.xcscheme @@ -1,6 +1,6 @@