diff --git a/ADChromePullToRefresh.podspec b/ADChromePullToRefresh.podspec index 057b5f9..147c182 100644 --- a/ADChromePullToRefresh.podspec +++ b/ADChromePullToRefresh.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ADChromePullToRefresh" - s.version = "0.5.0" + s.version = "1.0.0" s.summary = "Google Chrome iOS app pull to refresh" s.description = <<-DESC Yet another pull to refresh for your needs @@ -16,4 +16,4 @@ Pod::Spec.new do |s| s.source_files = 'Source/*' s.frameworks = 'UIKit' -end \ No newline at end of file +end diff --git a/ADChromePullToRefresh.xcodeproj/project.pbxproj b/ADChromePullToRefresh.xcodeproj/project.pbxproj index 545375a..5cbdc80 100644 --- a/ADChromePullToRefresh.xcodeproj/project.pbxproj +++ b/ADChromePullToRefresh.xcodeproj/project.pbxproj @@ -203,7 +203,7 @@ attributes = { LastSwiftMigration = 0710; LastSwiftUpdateCheck = 0710; - LastUpgradeCheck = 0710; + LastUpgradeCheck = 0810; ORGANIZATIONNAME = "Anton Domashnev"; TargetAttributes = { 6D97B6E91AE2C30D0003DDEA = { @@ -326,8 +326,10 @@ 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_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -336,6 +338,7 @@ 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", @@ -370,8 +373,10 @@ 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_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -379,6 +384,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; @@ -388,6 +394,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.2; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; diff --git a/README.md b/README.md index 485245a..da6b40b 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ You can simply setup your own chrome style pull to refresh using the initializer * @param scrollViewOriginalOffsetY - initial offset y of the given scrollView * @param delegate - object conformed to ADChromePullToRefreshDelegate protocol */ -init(view: UIView, forScrollView scrollView: UIScrollView, scrollViewOriginalOffsetY: CGFloat, delegate: ADChromePullToRefreshDelegate) +init(view: UIView, forScrollView scrollView: UIScrollView, scrollViewOriginalOffsetY: CGFloat, delegate: ADChromePullToRefreshDelegate) ``` To provide custom handler for pull to refresh actions you need to implement this delegate methos in your class @@ -29,7 +29,7 @@ To provide custom handler for pull to refresh actions you need to implement this /* * Use this function to provide an action for the given action view type */ -func chromePullToRefresh(pullToRefresh: ADChromePullToRefresh, actionForViewWithType: ADChromePullToRefreshActionViewType) -> ADChromePullToRefreshAction? +func chromePullToRefresh(_ pullToRefresh: ADChromePullToRefresh, actionForViewWithType: ADChromePullToRefreshActionViewType) -> ADChromePullToRefreshAction? ``` You're able to customize pull to refresh action view according to your needs 🚀 @@ -41,7 +41,7 @@ You're able to customize pull to refresh action view according to your needs * @see ADChromePullToRefreshActionView.swift * @see UITableViewDelegate - similar method to get header and footer view */ -func chromePullToRefresh(pullToRefresh: ADChromePullToRefresh, viewWithType: ADChromePullToRefreshActionViewType) -> ADChromePullToRefreshActionView +func chromePullToRefresh(_ pullToRefresh: ADChromePullToRefresh, viewWithType: ADChromePullToRefreshActionViewType) -> ADChromePullToRefreshActionView ``` ## Easy to install diff --git a/Source/ADChromePullToRefresh.swift b/Source/ADChromePullToRefresh.swift index 5b69706..b68e560 100644 --- a/Source/ADChromePullToRefresh.swift +++ b/Source/ADChromePullToRefresh.swift @@ -109,7 +109,7 @@ class ADChromePullToRefresh: NSObject, ADChromePullToRefreshViewDelegate { } func setUpConstraints() { - let viewsDictionary = ["pullToRefresh" : self.pullToRefreshView] + let viewsDictionary: [String : ADChromePullToRefreshView] = ["pullToRefresh" : self.pullToRefreshView] let horizontalConstraints: [NSLayoutConstraint] = NSLayoutConstraint.constraints(withVisualFormat: "H:|[pullToRefresh]|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: viewsDictionary) self.pullToRefreshSuperview.addConstraints(horizontalConstraints) let verticalConstraints: [NSLayoutConstraint] = NSLayoutConstraint.constraints(withVisualFormat: "V:|[pullToRefresh]", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: viewsDictionary) diff --git a/Source/ADChromePullToRefreshActionView.swift b/Source/ADChromePullToRefreshActionView.swift index ff4c834..b5b2bc5 100644 --- a/Source/ADChromePullToRefreshActionView.swift +++ b/Source/ADChromePullToRefreshActionView.swift @@ -77,7 +77,7 @@ class ADChromePullToRefreshActionView: UIView { } func setUpConstraints() { - let viewsDictionary = ["iconView" : self.iconView] + let viewsDictionary: [String : UIView] = ["iconView" : self.iconView] let horizontalConstraints: NSArray = NSLayoutConstraint.constraints(withVisualFormat: "H:|[iconView]|", options: NSLayoutFormatOptions(), metrics: nil, views: viewsDictionary) as NSArray self.addConstraints(horizontalConstraints as! [NSLayoutConstraint]) let verticalConstraints: NSArray = NSLayoutConstraint.constraints(withVisualFormat: "V:|[iconView]|", options: NSLayoutFormatOptions(), metrics: nil, views: viewsDictionary) as NSArray diff --git a/Source/ADChromePullToRefreshView.swift b/Source/ADChromePullToRefreshView.swift index d0d8352..74024bd 100644 --- a/Source/ADChromePullToRefreshView.swift +++ b/Source/ADChromePullToRefreshView.swift @@ -161,14 +161,14 @@ class ADChromePullToRefreshView: UIView { func setUpConstraints() { let verticalMargin = (self.bounds.height - self.viewsSize.height) / 2 let horizontalMargin = (self.bounds.width - self.viewsSize.width * 3 - self.leftActionLeftMargin - self.rightActionRightMargin) / 2 - let viewsDictionary = ["refreshView" : self.centerActionView, "leftActionView" : self.leftActionView, "rightActionView" : self.rightActionView, "highlightView": self.highlightView] - let metricsDictionary = ["leftActionLeft": self.leftActionLeftMargin, "rightActionRight": self.rightActionRightMargin, "viewsMargin": horizontalMargin, "viewWidth": self.viewsSize.width, "viewHeight": self.viewsSize.height, "verticalMargin": verticalMargin] + let viewsDictionary: [String : UIView] = ["refreshView" : self.centerActionView, "leftActionView" : self.leftActionView, "rightActionView" : self.rightActionView, "highlightView": self.highlightView] + let metricsDictionary: [String : CGFloat] = ["leftActionLeft": self.leftActionLeftMargin, "rightActionRight": self.rightActionRightMargin, "viewsMargin": horizontalMargin, "viewWidth": self.viewsSize.width, "viewHeight": self.viewsSize.height, "verticalMargin": verticalMargin] let horizontalConstraints: [NSLayoutConstraint] = NSLayoutConstraint.constraints(withVisualFormat: "|-(leftActionLeft)-[leftActionView(viewWidth)]-(viewsMargin)-[refreshView(viewWidth)]-(viewsMargin)-[rightActionView(viewWidth)]-(rightActionRight)-|", options: NSLayoutFormatOptions(rawValue: 0), metrics: metricsDictionary as [String : AnyObject], views: viewsDictionary) self.addConstraints(horizontalConstraints) - let actionViews = [self.centerActionView, self.leftActionView, self.rightActionView] + let actionViews: [ADChromePullToRefreshActionView] = [self.centerActionView, self.leftActionView, self.rightActionView] for actionView in actionViews { - self.addConstraint(self.centerYConstraintForView(actionView!)) + self.addConstraint(self.centerYConstraintForView(actionView)) } self.refreshViewHeightConstraint = self.heightConstraintForActionView(self.centerActionView) @@ -180,7 +180,7 @@ class ADChromePullToRefreshView: UIView { self.rightActionView.addConstraint(self.rightActionViewHeightConstraint) for actionView in actionViews { - actionView?.setUpConstraints() + actionView.setUpConstraints() } let highlightHorizontalConstraints: [NSLayoutConstraint] = NSLayoutConstraint.constraints(withVisualFormat: "H:|[highlightView]|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: viewsDictionary)