diff --git a/.swift-version b/.swift-version index 7d5c902..bf77d54 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -4.1 +4.2 diff --git a/Example/AppDelegate.swift b/Example/AppDelegate.swift index 3f7f2c9..5747048 100644 --- a/Example/AppDelegate.swift +++ b/Example/AppDelegate.swift @@ -10,11 +10,9 @@ import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { - var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { - // Override point for customization after application launch. + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { return true } @@ -37,5 +35,4 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func applicationWillTerminate(_ application: UIApplication) { } - } diff --git a/Example/EmptyDataDemoCollectionViewController.swift b/Example/EmptyDataDemoCollectionViewController.swift index 241256a..cab4a47 100644 --- a/Example/EmptyDataDemoCollectionViewController.swift +++ b/Example/EmptyDataDemoCollectionViewController.swift @@ -25,7 +25,7 @@ class EmptyDataDemoCollectionViewController: UICollectionViewController { super.viewDidLoad() navigationItem.title = "CollectionView" - collectionView?.backgroundColor = UIColor.white + collectionView?.backgroundColor = .white collectionView?.emptyDataSetDataSource = self collectionView?.emptyDataSetDelegate = self @@ -87,7 +87,7 @@ extension EmptyDataDemoCollectionViewController: TBEmptyDataSetDataSource, TBEmp func titleForEmptyDataSet(in scrollView: UIScrollView) -> NSAttributedString? { let title = EmptyData.titles[indexPath.row] - var attributes: [NSAttributedStringKey: Any]? + var attributes: [NSAttributedString.Key: Any]? if indexPath.row == 1 { attributes = [.font: UIFont.systemFont(ofSize: 22), .foregroundColor: UIColor.gray] @@ -100,7 +100,7 @@ extension EmptyDataDemoCollectionViewController: TBEmptyDataSetDataSource, TBEmp func descriptionForEmptyDataSet(in scrollView: UIScrollView) -> NSAttributedString? { let description = EmptyData.descriptions[indexPath.row] - var attributes: [NSAttributedStringKey: Any]? + var attributes: [NSAttributedString.Key: Any]? if indexPath.row == 1 { attributes = [.font: UIFont.systemFont(ofSize: 17), .foregroundColor: UIColor(red: 3 / 255, green: 169 / 255, blue: 244 / 255, alpha: 1)] @@ -223,7 +223,7 @@ class ExampleCustomView: UIView { fileprivate lazy var contentLabel: UILabel = { let contentLabel = UILabel() contentLabel.numberOfLines = 0 - contentLabel.textColor = UIColor.white + contentLabel.textColor = .white contentLabel.translatesAutoresizingMaskIntoConstraints = false return contentLabel }() @@ -239,10 +239,10 @@ class ExampleCustomView: UIView { } fileprivate func commonInit() { - backgroundColor = UIColor.lightGray + backgroundColor = .lightGray layer.cornerRadius = 6 - let activityIndicatorView = UIActivityIndicatorView(activityIndicatorStyle: .whiteLarge) + let activityIndicatorView = UIActivityIndicatorView(style: .whiteLarge) activityIndicatorView.translatesAutoresizingMaskIntoConstraints = false activityIndicatorView.startAnimating() contentLabel.text = "Loading... Please wait a moment...\n\n(This is a custom empty data view, which is using pure AutoLayout)" diff --git a/Example/EmptyDataDemoTableViewController.swift b/Example/EmptyDataDemoTableViewController.swift index 998b888..a427269 100644 --- a/Example/EmptyDataDemoTableViewController.swift +++ b/Example/EmptyDataDemoTableViewController.swift @@ -91,7 +91,7 @@ extension EmptyDataDemoTableViewController: TBEmptyDataSetDataSource, TBEmptyDat func titleForEmptyDataSet(in scrollView: UIScrollView) -> NSAttributedString? { let title = EmptyData.titles[indexPath.row] - var attributes: [NSAttributedStringKey: Any]? + var attributes: [NSAttributedString.Key: Any]? if indexPath.row == 1 { attributes = [.font: UIFont.systemFont(ofSize: 22), .foregroundColor: UIColor.gray] @@ -104,7 +104,7 @@ extension EmptyDataDemoTableViewController: TBEmptyDataSetDataSource, TBEmptyDat func descriptionForEmptyDataSet(in scrollView: UIScrollView) -> NSAttributedString? { let description = EmptyData.descriptions[indexPath.row] - var attributes: [NSAttributedStringKey: Any]? + var attributes: [NSAttributedString.Key: Any]? if indexPath.row == 1 { attributes = [.font: UIFont.systemFont(ofSize: 17), .foregroundColor: UIColor(red: 3 / 255, green: 169 / 255, blue: 244 / 255, alpha: 1)] @@ -128,7 +128,7 @@ extension EmptyDataDemoTableViewController: TBEmptyDataSetDataSource, TBEmptyDat func customViewForEmptyDataSet(in scrollView: UIScrollView) -> UIView? { if isLoading { - let activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .gray) + let activityIndicator = UIActivityIndicatorView(style: .gray) activityIndicator.startAnimating() return activityIndicator } diff --git a/Example/Info.plist b/Example/Info.plist index 7d2ec62..19bb64f 100644 --- a/Example/Info.plist +++ b/Example/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 2.7 + 2.8 CFBundleSignature ???? CFBundleVersion - 18 + 19 LSRequiresIPhoneOS UILaunchStoryboardName diff --git a/TBEmptyDataSet.podspec b/TBEmptyDataSet.podspec index 4b88aa2..5c6c75f 100644 --- a/TBEmptyDataSet.podspec +++ b/TBEmptyDataSet.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "TBEmptyDataSet" - s.version = "2.7" + s.version = "2.8" s.summary = "An extension of UITableView/UICollectionView's super class, it will display a placeholder when the data is empty." s.homepage = "https://github.com/teambition/TBEmptyDataSet" diff --git a/TBEmptyDataSet.xcodeproj/project.pbxproj b/TBEmptyDataSet.xcodeproj/project.pbxproj index 50bb580..ea21363 100644 --- a/TBEmptyDataSet.xcodeproj/project.pbxproj +++ b/TBEmptyDataSet.xcodeproj/project.pbxproj @@ -289,7 +289,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -309,7 +309,7 @@ PRODUCT_BUNDLE_IDENTIFIER = Teambition.TBEmptyDataSet; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; diff --git a/TBEmptyDataSet/EmptyDataView.swift b/TBEmptyDataSet/EmptyDataView.swift index cca1ac2..0fb53a1 100644 --- a/TBEmptyDataSet/EmptyDataView.swift +++ b/TBEmptyDataSet/EmptyDataView.swift @@ -21,7 +21,7 @@ internal class EmptyDataView: UIView { internal lazy var contentView: UIView = { let contentView = UIView() contentView.translatesAutoresizingMaskIntoConstraints = false - contentView.backgroundColor = UIColor.clear + contentView.backgroundColor = .clear contentView.alpha = 0 return contentView }() @@ -29,7 +29,7 @@ internal class EmptyDataView: UIView { internal lazy var imageView: UIImageView = { [unowned self] in let imageView = UIImageView() imageView.translatesAutoresizingMaskIntoConstraints = false - imageView.backgroundColor = UIColor.clear + imageView.backgroundColor = .clear imageView.contentMode = .scaleAspectFill self.contentView.addSubview(imageView) return imageView @@ -38,8 +38,8 @@ internal class EmptyDataView: UIView { internal lazy var titleLabel: UILabel = { [unowned self] in let titleLabel = UILabel() titleLabel.translatesAutoresizingMaskIntoConstraints = false - titleLabel.backgroundColor = UIColor.clear - titleLabel.font = UIFont.systemFont(ofSize: 27) + titleLabel.backgroundColor = .clear + titleLabel.font = .systemFont(ofSize: 27) titleLabel.textColor = UIColor(white: 0.6, alpha: 1) titleLabel.textAlignment = .center titleLabel.lineBreakMode = .byWordWrapping @@ -51,8 +51,8 @@ internal class EmptyDataView: UIView { internal lazy var descriptionLabel: UILabel = { [unowned self] in let descriptionLabel = UILabel() descriptionLabel.translatesAutoresizingMaskIntoConstraints = false - descriptionLabel.backgroundColor = UIColor.clear - descriptionLabel.font = UIFont.systemFont(ofSize: 17) + descriptionLabel.backgroundColor = .clear + descriptionLabel.font = .systemFont(ofSize: 17) descriptionLabel.textColor = UIColor(white: 0.6, alpha: 1) descriptionLabel.textAlignment = .center descriptionLabel.lineBreakMode = .byWordWrapping diff --git a/TBEmptyDataSet/Supporting Files/Info.plist b/TBEmptyDataSet/Supporting Files/Info.plist index 60fb8d4..c060340 100644 --- a/TBEmptyDataSet/Supporting Files/Info.plist +++ b/TBEmptyDataSet/Supporting Files/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.7 + 2.8 CFBundleSignature ???? CFBundleVersion diff --git a/TBEmptyDataSetExample.xcodeproj/project.pbxproj b/TBEmptyDataSetExample.xcodeproj/project.pbxproj index be5eec2..5382d63 100644 --- a/TBEmptyDataSetExample.xcodeproj/project.pbxproj +++ b/TBEmptyDataSetExample.xcodeproj/project.pbxproj @@ -166,7 +166,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi"; + shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; }; /* End PBXShellScriptBuildPhase section */ @@ -309,7 +309,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = Teambition.TBEmptyDataSetExample; PRODUCT_NAME = TBEmptyDataSetExample; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -322,7 +322,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = Teambition.TBEmptyDataSetExample; PRODUCT_NAME = TBEmptyDataSetExample; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; };