diff --git a/DGElasticPullToRefresh/DGElasticPullToRefreshExtensions.swift b/DGElasticPullToRefresh/DGElasticPullToRefreshExtensions.swift index ab4f89e..53b2396 100644 --- a/DGElasticPullToRefresh/DGElasticPullToRefreshExtensions.swift +++ b/DGElasticPullToRefresh/DGElasticPullToRefreshExtensions.swift @@ -157,8 +157,8 @@ public extension UIPanGestureRecognizer { // MARK: - // MARK: (UIGestureRecognizerState) Extension -public extension UIGestureRecognizerState { - func dg_isAnyOf(_ values: [UIGestureRecognizerState]) -> Bool { +public extension UIGestureRecognizer.State { + func dg_isAnyOf(_ values: [UIGestureRecognizer.State]) -> Bool { return values.contains(where: { $0 == self }) } } diff --git a/DGElasticPullToRefresh/DGElasticPullToRefreshLoadingViewCircle.swift b/DGElasticPullToRefresh/DGElasticPullToRefreshLoadingViewCircle.swift index c510baf..781af5d 100644 --- a/DGElasticPullToRefresh/DGElasticPullToRefreshLoadingViewCircle.swift +++ b/DGElasticPullToRefresh/DGElasticPullToRefreshLoadingViewCircle.swift @@ -32,11 +32,11 @@ import UIKit public extension CGFloat { public func toRadians() -> CGFloat { - return (self * CGFloat(M_PI)) / 180.0 + return (self * CGFloat(Double.pi)) / 180.0 } public func toDegrees() -> CGFloat { - return self * 180.0 / CGFloat(M_PI) + return self * 180.0 / CGFloat(Double.pi) } } @@ -99,11 +99,11 @@ open class DGElasticPullToRefreshLoadingViewCircle: DGElasticPullToRefreshLoadin if shapeLayer.animation(forKey: kRotationAnimation) != nil { return } let rotationAnimation = CABasicAnimation(keyPath: "transform.rotation.z") - rotationAnimation.toValue = CGFloat(2 * M_PI) + currentDegree() + rotationAnimation.toValue = CGFloat(2 * Double.pi) + currentDegree() rotationAnimation.duration = 1.0 rotationAnimation.repeatCount = Float.infinity rotationAnimation.isRemovedOnCompletion = false - rotationAnimation.fillMode = kCAFillModeForwards + rotationAnimation.fillMode = CAMediaTimingFillMode.forwards shapeLayer.add(rotationAnimation, forKey: kRotationAnimation) } diff --git a/DGElasticPullToRefresh/DGElasticPullToRefreshView.swift b/DGElasticPullToRefresh/DGElasticPullToRefreshView.swift index d393eaf..c715b58 100644 --- a/DGElasticPullToRefresh/DGElasticPullToRefreshView.swift +++ b/DGElasticPullToRefresh/DGElasticPullToRefreshView.swift @@ -124,7 +124,7 @@ open class DGElasticPullToRefreshView: UIView { super.init(frame: CGRect.zero) displayLink = CADisplayLink(target: self, selector: #selector(DGElasticPullToRefreshView.displayLinkTick)) - displayLink.add(to: RunLoop.main, forMode: RunLoopMode.commonModes) + displayLink.add(to: RunLoop.main, forMode: RunLoop.Mode.common) displayLink.isPaused = true shapeLayer.backgroundColor = UIColor.clear.cgColor @@ -141,7 +141,7 @@ open class DGElasticPullToRefreshView: UIView { addSubview(r2ControlPointView) addSubview(r3ControlPointView) - NotificationCenter.default.addObserver(self, selector: #selector(DGElasticPullToRefreshView.applicationWillEnterForeground), name: NSNotification.Name.UIApplicationWillEnterForeground, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(DGElasticPullToRefreshView.applicationWillEnterForeground), name: UIApplication.willEnterForegroundNotification, object: nil) } required public init?(coder aDecoder: NSCoder) { @@ -193,7 +193,7 @@ open class DGElasticPullToRefreshView: UIView { // MARK: - // MARK: Notifications - func applicationWillEnterForeground() { + @objc func applicationWillEnterForeground() { if state == .loading { layoutSubviews() } @@ -355,7 +355,7 @@ open class DGElasticPullToRefreshView: UIView { displayLink.isPaused = true } - func displayLinkTick() { + @objc func displayLinkTick() { let width = bounds.width var height: CGFloat = 0.0 diff --git a/DGElasticPullToRefreshExample.xcodeproj/project.pbxproj b/DGElasticPullToRefreshExample.xcodeproj/project.pbxproj index c778cf5..7ed047d 100644 --- a/DGElasticPullToRefreshExample.xcodeproj/project.pbxproj +++ b/DGElasticPullToRefreshExample.xcodeproj/project.pbxproj @@ -113,12 +113,12 @@ 05CD145D1BBE8FEA00AF4030 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0700; + LastUpgradeCheck = 1010; ORGANIZATIONNAME = "Danil Gontovnik"; TargetAttributes = { 05CD14641BBE8FEA00AF4030 = { CreatedOnToolsVersion = 7.0; - LastSwiftMigration = 0800; + LastSwiftMigration = 1010; }; }; }; @@ -190,13 +190,23 @@ 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"; @@ -235,13 +245,23 @@ 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"; @@ -260,6 +280,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -274,7 +295,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.gatafan.DGElasticPullToRefreshExample; PRODUCT_NAME = DGElasticPullToRefreshExample; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -287,7 +309,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.gatafan.DGElasticPullToRefreshExample; PRODUCT_NAME = DGElasticPullToRefreshExample; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.2; }; name = Release; }; diff --git a/DGElasticPullToRefreshExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/DGElasticPullToRefreshExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/DGElasticPullToRefreshExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/DGElasticPullToRefreshExample.xcodeproj/project.xcworkspace/xcuserdata/matteocrippa.xcuserdatad/UserInterfaceState.xcuserstate b/DGElasticPullToRefreshExample.xcodeproj/project.xcworkspace/xcuserdata/matteocrippa.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..db60a9c Binary files /dev/null and b/DGElasticPullToRefreshExample.xcodeproj/project.xcworkspace/xcuserdata/matteocrippa.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/DGElasticPullToRefreshExample.xcodeproj/xcuserdata/matteocrippa.xcuserdatad/xcschemes/xcschememanagement.plist b/DGElasticPullToRefreshExample.xcodeproj/xcuserdata/matteocrippa.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..5056fef --- /dev/null +++ b/DGElasticPullToRefreshExample.xcodeproj/xcuserdata/matteocrippa.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + DGElasticPullToRefreshExample.xcscheme_^#shared#^_ + + orderHint + 0 + + + +