diff --git a/ESPullToRefreshExample/ESPullToRefreshExample.xcodeproj/project.pbxproj b/ESPullToRefreshExample/ESPullToRefreshExample.xcodeproj/project.pbxproj index 9183687..3537388 100644 --- a/ESPullToRefreshExample/ESPullToRefreshExample.xcodeproj/project.pbxproj +++ b/ESPullToRefreshExample/ESPullToRefreshExample.xcodeproj/project.pbxproj @@ -321,7 +321,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 1000; ORGANIZATIONNAME = "egg swift"; TargetAttributes = { F690772C1D0D0AE300BE91FE = { @@ -465,6 +465,7 @@ F69077331D0D0AE300BE91FE /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; @@ -478,7 +479,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.eggswift.ESPullToRefresh; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -487,6 +488,7 @@ F69077341D0D0AE300BE91FE /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; @@ -500,7 +502,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.eggswift.ESPullToRefresh; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -516,14 +518,22 @@ 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; @@ -566,14 +576,22 @@ 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; @@ -612,7 +630,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.eggswift.ESPullToRefreshExample11; PRODUCT_NAME = Example; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -628,7 +646,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.eggswift.ESPullToRefreshExample11; PRODUCT_NAME = Example; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; diff --git a/ESPullToRefreshExample/ESPullToRefreshExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ESPullToRefreshExample/ESPullToRefreshExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ESPullToRefreshExample/ESPullToRefreshExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ESPullToRefreshExample/ESPullToRefreshExample.xcodeproj/xcshareddata/xcschemes/ESPullToRefresh.xcscheme b/ESPullToRefreshExample/ESPullToRefreshExample.xcodeproj/xcshareddata/xcschemes/ESPullToRefresh.xcscheme index bba3e36..cd30463 100644 --- a/ESPullToRefreshExample/ESPullToRefreshExample.xcodeproj/xcshareddata/xcschemes/ESPullToRefresh.xcscheme +++ b/ESPullToRefreshExample/ESPullToRefreshExample.xcodeproj/xcshareddata/xcschemes/ESPullToRefresh.xcscheme @@ -1,6 +1,6 @@ Bool { + private func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true diff --git a/ESPullToRefreshExample/ESPullToRefreshExample/Custom/CollectionView/CollectionViewController.swift b/ESPullToRefreshExample/ESPullToRefreshExample/Custom/CollectionView/CollectionViewController.swift index fdf48ed..a7ba32a 100644 --- a/ESPullToRefreshExample/ESPullToRefreshExample/Custom/CollectionView/CollectionViewController.swift +++ b/ESPullToRefreshExample/ESPullToRefreshExample/Custom/CollectionView/CollectionViewController.swift @@ -16,7 +16,7 @@ class CollectionViewController: UIViewController { collectionView.translatesAutoresizingMaskIntoConstraints = false collectionView.alwaysBounceVertical = true collectionView.register(DemoCollectionViewCell.self, forCellWithReuseIdentifier: "DemoCell") - collectionView.contentInset = UIEdgeInsetsMake(12.0, 15.0, 0, 15.0) + collectionView.contentInset = UIEdgeInsets(top: 12.0, left: 15.0, bottom: 0, right: 15.0) collectionView.backgroundColor = .white return collectionView }() diff --git a/ESPullToRefreshExample/ESPullToRefreshExample/Custom/ESRefreshTableViewController.swift b/ESPullToRefreshExample/ESPullToRefreshExample/Custom/ESRefreshTableViewController.swift index f682028..dbf5661 100644 --- a/ESPullToRefreshExample/ESPullToRefreshExample/Custom/ESRefreshTableViewController.swift +++ b/ESPullToRefreshExample/ESPullToRefreshExample/Custom/ESRefreshTableViewController.swift @@ -14,7 +14,7 @@ public class ESRefreshTableViewController: UITableViewController { public var page = 1 public var type: ESRefreshExampleType = .defaulttype - public override init(style: UITableViewStyle) { + public override init(style: UITableView.Style) { super.init(style: style) for num in 1...8{ if num % 2 == 0 && arc4random() % 4 == 0 { @@ -36,7 +36,7 @@ public class ESRefreshTableViewController: UITableViewController { self.tableView.register(UINib.init(nibName: "ESRefreshTableViewCell", bundle: nil), forCellReuseIdentifier: "ESRefreshTableViewCell") self.tableView.register(UINib.init(nibName: "ESPhotoTableViewCell", bundle: nil), forCellReuseIdentifier: "ESPhotoTableViewCell") - self.tableView.rowHeight = UITableViewAutomaticDimension + self.tableView.rowHeight = UITableView.automaticDimension self.tableView.estimatedRowHeight = 560 self.tableView.separatorStyle = .none self.tableView.separatorColor = UIColor.clear diff --git a/ESPullToRefreshExample/ESPullToRefreshExample/Custom/Meituan/MTRefreshFooterAnimator.swift b/ESPullToRefreshExample/ESPullToRefreshExample/Custom/Meituan/MTRefreshFooterAnimator.swift index 9954fe7..25d1bc2 100644 --- a/ESPullToRefreshExample/ESPullToRefreshExample/Custom/Meituan/MTRefreshFooterAnimator.swift +++ b/ESPullToRefreshExample/ESPullToRefreshExample/Custom/Meituan/MTRefreshFooterAnimator.swift @@ -39,7 +39,7 @@ public class MTRefreshFooterAnimator: UIView, ESRefreshProtocol, ESRefreshAnimat return label }() private let indicatorView: UIActivityIndicatorView = { - let indicatorView = UIActivityIndicatorView.init(activityIndicatorStyle: .gray) + let indicatorView = UIActivityIndicatorView.init(style: .gray) indicatorView.isHidden = true return indicatorView }() diff --git a/ESPullToRefreshExample/ESPullToRefreshExample/Custom/TextView/TextViewController.swift b/ESPullToRefreshExample/ESPullToRefreshExample/Custom/TextView/TextViewController.swift index fa821d6..2a3ad1f 100644 --- a/ESPullToRefreshExample/ESPullToRefreshExample/Custom/TextView/TextViewController.swift +++ b/ESPullToRefreshExample/ESPullToRefreshExample/Custom/TextView/TextViewController.swift @@ -38,7 +38,7 @@ class TextViewController: UIViewController { style.lineSpacing = 0.0 style.firstLineHeadIndent = 10.0 style.alignment = .justified - self?.textView.attributedText = NSAttributedString.init(string: (self?.text1)!, attributes: [NSAttributedStringKey.paragraphStyle : style, NSAttributedStringKey.font: UIFont.init(name: "ChalkboardSE-Bold", size: 16.0)!, NSAttributedStringKey.foregroundColor: UIColor.init(white: 0.3, alpha: 1.0)]) + self?.textView.attributedText = NSAttributedString.init(string: (self?.text1)!, attributes: [NSAttributedString.Key.paragraphStyle : style, NSAttributedString.Key.font: UIFont.init(name: "ChalkboardSE-Bold", size: 16.0)!, NSAttributedString.Key.foregroundColor: UIColor.init(white: 0.3, alpha: 1.0)]) self?.textView.es.stopPullToRefresh() } } @@ -74,7 +74,7 @@ class TextViewController: UIViewController { style.lineSpacing = 0.0 style.firstLineHeadIndent = 10.0 style.alignment = .justified - self?.textView.attributedText = NSAttributedString.init(string: str, attributes: [NSAttributedStringKey.paragraphStyle : style, NSAttributedStringKey.font: UIFont.init(name: "ChalkboardSE-Bold", size: 16.0)!, NSAttributedStringKey.foregroundColor: UIColor.init(white: 0.3, alpha: 1.0)]) + self?.textView.attributedText = NSAttributedString.init(string: str, attributes: [NSAttributedString.Key.paragraphStyle : style, NSAttributedString.Key.font: UIFont.init(name: "ChalkboardSE-Bold", size: 16.0)!, NSAttributedString.Key.foregroundColor: UIColor.init(white: 0.3, alpha: 1.0)]) self?.textView.es.stopLoadingMore() } diff --git a/ESPullToRefreshExample/ESPullToRefreshExample/Custom/WeChat/WCRefreshHeaderAnimator.swift b/ESPullToRefreshExample/ESPullToRefreshExample/Custom/WeChat/WCRefreshHeaderAnimator.swift index 7b9b654..4b83b08 100644 --- a/ESPullToRefreshExample/ESPullToRefreshExample/Custom/WeChat/WCRefreshHeaderAnimator.swift +++ b/ESPullToRefreshExample/ESPullToRefreshExample/Custom/WeChat/WCRefreshHeaderAnimator.swift @@ -84,7 +84,7 @@ public class WCRefreshHeaderAnimator: UIView, ESRefreshProtocol, ESRefreshAnimat func startAnimating() { if timer == nil { timer = Timer.scheduledTimer(timeInterval: 0.01, target: self, selector: #selector(WCRefreshHeaderAnimator.timerAction), userInfo: nil, repeats: true) - RunLoop.current.add(timer!, forMode: RunLoopMode.commonModes) + RunLoop.current.add(timer!, forMode: RunLoop.Mode.common) } } diff --git a/ESPullToRefreshExample/ESPullToRefreshExample/ViewController.swift b/ESPullToRefreshExample/ESPullToRefreshExample/ViewController.swift index ad89ed7..f88b745 100644 --- a/ESPullToRefreshExample/ESPullToRefreshExample/ViewController.swift +++ b/ESPullToRefreshExample/ESPullToRefreshExample/ViewController.swift @@ -37,7 +37,7 @@ public class ViewController: UIViewController, UITableViewDataSource, UITableVie self.navigationController?.navigationBar.isTranslucent = true self.navigationController?.navigationBar.barTintColor = UIColor.init(red: 250/255.0, green: 250/255.0, blue: 250/255.0, alpha: 0.8) - self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor : UIColor.init(red: 38/255.0, green: 38/255.0, blue: 38/255.0, alpha: 1.0), NSAttributedStringKey.font: UIFont.systemFont(ofSize: 16.0)] + self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor : UIColor.init(red: 38/255.0, green: 38/255.0, blue: 38/255.0, alpha: 1.0), NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16.0)] self.navigationController?.navigationBar.tintColor = UIColor.init(red: 38/255.0, green: 38/255.0, blue: 38/255.0, alpha: 1.0) self.navigationItem.title = "Example" diff --git a/Sources/Animator/ESRefreshFooterAnimator.swift b/Sources/Animator/ESRefreshFooterAnimator.swift index 59e1a33..fe05d8c 100644 --- a/Sources/Animator/ESRefreshFooterAnimator.swift +++ b/Sources/Animator/ESRefreshFooterAnimator.swift @@ -47,7 +47,7 @@ open class ESRefreshFooterAnimator: UIView, ESRefreshProtocol, ESRefreshAnimator }() fileprivate let indicatorView: UIActivityIndicatorView = { - let indicatorView = UIActivityIndicatorView.init(activityIndicatorStyle: .gray) + let indicatorView = UIActivityIndicatorView.init(style: .gray) indicatorView.isHidden = true return indicatorView }() diff --git a/Sources/Animator/ESRefreshHeaderAnimator.swift b/Sources/Animator/ESRefreshHeaderAnimator.swift index b24c4a2..b939cd4 100644 --- a/Sources/Animator/ESRefreshHeaderAnimator.swift +++ b/Sources/Animator/ESRefreshHeaderAnimator.swift @@ -66,7 +66,7 @@ open class ESRefreshHeaderAnimator: UIView, ESRefreshProtocol, ESRefreshAnimator }() fileprivate let indicatorView: UIActivityIndicatorView = { - let indicatorView = UIActivityIndicatorView.init(activityIndicatorStyle: .gray) + let indicatorView = UIActivityIndicatorView.init(style: .gray) indicatorView.isHidden = true return indicatorView }() @@ -119,7 +119,7 @@ open class ESRefreshHeaderAnimator: UIView, ESRefreshProtocol, ESRefreshAnimator titleLabel.text = releaseToRefreshDescription self.setNeedsLayout() self.impact() - UIView.animate(withDuration: 0.2, delay: 0.0, options: UIViewAnimationOptions(), animations: { + UIView.animate(withDuration: 0.2, delay: 0.0, options: UIView.AnimationOptions(), animations: { [weak self] in self?.imageView.transform = CGAffineTransform(rotationAngle: 0.000001 - CGFloat.pi) }) { (animated) in } @@ -127,7 +127,7 @@ open class ESRefreshHeaderAnimator: UIView, ESRefreshProtocol, ESRefreshAnimator case .pullToRefresh: titleLabel.text = pullToRefreshDescription self.setNeedsLayout() - UIView.animate(withDuration: 0.2, delay: 0.0, options: UIViewAnimationOptions(), animations: { + UIView.animate(withDuration: 0.2, delay: 0.0, options: UIView.AnimationOptions(), animations: { [weak self] in self?.imageView.transform = CGAffineTransform.identity }) { (animated) in } diff --git a/Sources/ESPullToRefresh+Manager.swift b/Sources/ESPullToRefresh+Manager.swift index 6196cb4..808a30d 100644 --- a/Sources/ESPullToRefresh+Manager.swift +++ b/Sources/ESPullToRefresh+Manager.swift @@ -88,16 +88,16 @@ open class ESRefreshDataManager { } } - open static func clearAll() { + public static func clearAll() { self.clearLastRefreshInfo() self.clearExpiredTimeIntervalInfo() } - open static func clearLastRefreshInfo() { + public static func clearLastRefreshInfo() { UserDefaults.standard.set(nil, forKey: ESRefreshDataManager.lastRefreshKey) } - open static func clearExpiredTimeIntervalInfo() { + public static func clearExpiredTimeIntervalInfo() { UserDefaults.standard.set(nil, forKey: ESRefreshDataManager.expiredTimeIntervalKey) } diff --git a/Sources/ESRefreshProtocol.swift b/Sources/ESRefreshProtocol.swift index b32ff3a..b7e0ca8 100644 --- a/Sources/ESRefreshProtocol.swift +++ b/Sources/ESRefreshProtocol.swift @@ -99,7 +99,7 @@ fileprivate class ESRefreshImpacter { return nil }() - static open func impact() -> Void { + static public func impact() -> Void { if #available(iOS 10.0, *) { if let impacter = impacter as? UIImpactFeedbackGenerator { impacter.impactOccurred()