diff --git a/Classes/RMRPullToRefreshController.swift b/Classes/RMRPullToRefreshController.swift index 599b2a7..d27b29b 100644 --- a/Classes/RMRPullToRefreshController.swift +++ b/Classes/RMRPullToRefreshController.swift @@ -8,7 +8,7 @@ import UIKit -open class RMRPullToRefreshController: NSObject { +open class RMRPullToRefreshController { // MARK: - Vars @@ -48,8 +48,7 @@ open class RMRPullToRefreshController: NSObject { // MARK: - Init init(scrollView: UIScrollView, position:RMRPullToRefreshPosition, actionHandler: @escaping () -> Void) { - - super.init() + self.scrollView = scrollView self.actionHandler = actionHandler self.position = position @@ -157,9 +156,14 @@ open class RMRPullToRefreshController: NSObject { } } self?.contentSizeWhenStartLoading = nil - self?.perform(#selector(self?.resetBackgroundViewHeightConstraint), with: nil, afterDelay: afterDelay) + + DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + afterDelay) { + self?.resetBackgroundViewHeightConstraint() + } + } + DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + afterDelay) { + self?.stopAllAnimations() } - self?.perform(#selector(self?.stopAllAnimations), with: nil, afterDelay: afterDelay) }) } diff --git a/Example/RMRPullToRefresh/Base.lproj/Main.storyboard b/Example/RMRPullToRefresh/Base.lproj/Main.storyboard index 440c9be..88cd43d 100644 --- a/Example/RMRPullToRefresh/Base.lproj/Main.storyboard +++ b/Example/RMRPullToRefresh/Base.lproj/Main.storyboard @@ -245,7 +245,7 @@ - + diff --git a/Example/RMRPullToRefreshExample.xcodeproj/project.pbxproj b/Example/RMRPullToRefreshExample.xcodeproj/project.pbxproj index 07510dd..26df298 100644 --- a/Example/RMRPullToRefreshExample.xcodeproj/project.pbxproj +++ b/Example/RMRPullToRefreshExample.xcodeproj/project.pbxproj @@ -372,8 +372,10 @@ baseConfigurationReference = 51A8D36C5CCC1E18D2666CD6 /* Pods-RMRPullToRefreshExample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = GMD7EK7S94; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = RMRPullToRefresh/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.redmadrobot.RMRPullToRefresh; PRODUCT_NAME = RMRPullToRefreshExample; @@ -386,8 +388,10 @@ baseConfigurationReference = 9373B01A0C7A0314295D05D2 /* Pods-RMRPullToRefreshExample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = GMD7EK7S94; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = RMRPullToRefresh/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.redmadrobot.RMRPullToRefresh; PRODUCT_NAME = RMRPullToRefreshExample;