diff --git a/.travis.yml b/.travis.yml index 45dcbbe..7a697f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: swift -osx_image: xcode9.3 +osx_image: xcode10 xcode_project: FunctionalTableData.xcodeproj xcode_schema: FunctionalTableDataTests notifications: diff --git a/FunctionalTableData.xcodeproj/project.pbxproj b/FunctionalTableData.xcodeproj/project.pbxproj index d00875d..806d20c 100644 --- a/FunctionalTableData.xcodeproj/project.pbxproj +++ b/FunctionalTableData.xcodeproj/project.pbxproj @@ -368,16 +368,17 @@ TargetAttributes = { 17E57FE5208A404700BFCC3D = { CreatedOnToolsVersion = 9.3; + LastSwiftMigration = 1000; ProvisioningStyle = Automatic; }; 4C7A26FB1F2FA0F800360E9B = { CreatedOnToolsVersion = 8.3.3; - LastSwiftMigration = 0900; + LastSwiftMigration = 1000; ProvisioningStyle = Automatic; }; 4C7A27041F2FA0F800360E9B = { CreatedOnToolsVersion = 8.3.3; - LastSwiftMigration = 0900; + LastSwiftMigration = 1000; ProvisioningStyle = Automatic; }; }; @@ -534,7 +535,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.jadedpixel.FunctionalTableDataDemo; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -555,7 +556,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.jadedpixel.FunctionalTableDataDemo; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -751,7 +752,7 @@ PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -774,7 +775,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; @@ -787,7 +788,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.shopify.FunctionalTableDataTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -800,7 +801,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.shopify.FunctionalTableDataTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; diff --git a/FunctionalTableData/CellStyle.swift b/FunctionalTableData/CellStyle.swift index 37aa606..03ba8db 100644 --- a/FunctionalTableData/CellStyle.swift +++ b/FunctionalTableData/CellStyle.swift @@ -34,7 +34,7 @@ public struct CellStyle { /// You use these constants when setting the value of the [accessoryType](apple-reference-documentation://hspQPOCGHb) property. /// /// Supported by `UITableView` only. - public var accessoryType: UITableViewCellAccessoryType = .none + public var accessoryType: UITableViewCell.AccessoryType = .none /// The view's selection color. public var selectionColor: UIColor? = CellStyle.selectionColor /// The view's background color. @@ -52,7 +52,7 @@ public struct CellStyle { bottomSeparator: Separator.Style? = nil, separatorColor: UIColor? = nil, highlight: Bool? = nil, - accessoryType: UITableViewCellAccessoryType = .none, + accessoryType: UITableViewCell.AccessoryType = .none, selectionColor: UIColor? = CellStyle.selectionColor, backgroundColor: UIColor? = nil, backgroundView: UIView? = nil, diff --git a/FunctionalTableData/CollectionView/FunctionalCollectionData.swift b/FunctionalTableData/CollectionView/FunctionalCollectionData.swift index 22a1ea3..78d11e3 100644 --- a/FunctionalTableData/CollectionView/FunctionalCollectionData.swift +++ b/FunctionalTableData/CollectionView/FunctionalCollectionData.swift @@ -348,7 +348,7 @@ public class FunctionalCollectionData: NSObject { /// - animated: `true` if you want to animate the selection, and `false` if the change should be immediate. /// - scrollPosition: An option that specifies where the item should be positioned when scrolling finishes. /// - triggerDelegate: `true` to trigger the `collection:didSelectItemAt:` delegate from `UICollectionView` or `false` to skip it. Skipping it is the default `UICollectionView` behavior. - public func select(keyPath: KeyPath, animated: Bool = true, scrollPosition: UICollectionViewScrollPosition = [], triggerDelegate: Bool = false) { + public func select(keyPath: KeyPath, animated: Bool = true, scrollPosition: UICollectionView.ScrollPosition = [], triggerDelegate: Bool = false) { guard let aCollectionView = collectionView, let indexPath = indexPathFromKeyPath(keyPath) else { return } aCollectionView.selectItem(at: indexPath, animated: animated, scrollPosition: scrollPosition) @@ -363,7 +363,7 @@ public class FunctionalCollectionData: NSObject { /// - keyPath: A key path identifying a row in the collection view. /// - animated: `true` to animate to the new scroll position, or `false` to scroll immediately. /// - scrollPosition: Specifies where the item specified by `keyPath` should be positioned once scrolling finishes. - public func scroll(to keyPath: KeyPath, animated: Bool = true, scrollPosition: UICollectionViewScrollPosition = [.bottom, .right]) { + public func scroll(to keyPath: KeyPath, animated: Bool = true, scrollPosition: UICollectionView.ScrollPosition = [.bottom, .right]) { guard let aCollectionView = collectionView, let indexPath = indexPathFromKeyPath(keyPath) else { return } aCollectionView.scrollToItem(at: indexPath, at: scrollPosition, animated: animated) } diff --git a/FunctionalTableData/Separator.swift b/FunctionalTableData/Separator.swift index 5ac1032..8398951 100644 --- a/FunctionalTableData/Separator.swift +++ b/FunctionalTableData/Separator.swift @@ -58,7 +58,7 @@ public class Separator: UIView { } public override var intrinsicContentSize: CGSize { - return CGSize(width: UIViewNoIntrinsicMetric, height: thickness) + return CGSize(width: UIView.noIntrinsicMetric, height: thickness) } public func constrainToTopOfView(_ view: UIView, constant: CGFloat = 0) { diff --git a/FunctionalTableData/TableView/FunctionalTableData.swift b/FunctionalTableData/TableView/FunctionalTableData.swift index f380347..7aec1bc 100644 --- a/FunctionalTableData/TableView/FunctionalTableData.swift +++ b/FunctionalTableData/TableView/FunctionalTableData.swift @@ -75,7 +75,7 @@ public class FunctionalTableData: NSObject { guard let tableView = tableView else { return } tableView.dataSource = self tableView.delegate = self - tableView.rowHeight = UITableViewAutomaticDimension + tableView.rowHeight = UITableView.automaticDimension tableView.tableFooterView = UIView(frame: .zero) tableView.separatorStyle = .none } @@ -113,13 +113,13 @@ public class FunctionalTableData: NSObject { /// The type of animation when rows and sections are inserted or deleted. public struct TableAnimations { public struct Actions { - let insert: UITableViewRowAnimation - let delete: UITableViewRowAnimation - let reload: UITableViewRowAnimation + let insert: UITableView.RowAnimation + let delete: UITableView.RowAnimation + let reload: UITableView.RowAnimation public static let `default` = Actions(insert: .fade, delete: .fade, reload: .automatic) public static let legacy = Actions(insert: .top, delete: .top, reload: .automatic) - public init(insert: UITableViewRowAnimation, delete: UITableViewRowAnimation, reload: UITableViewRowAnimation) { + public init(insert: UITableView.RowAnimation, delete: UITableView.RowAnimation, reload: UITableView.RowAnimation) { self.insert = insert self.delete = delete self.reload = reload @@ -425,7 +425,7 @@ public class FunctionalTableData: NSObject { /// - keyPath: A key path identifying a row in the table view. /// - animated: `true` if you want to animate the selection, and `false` if the change should be immediate. /// - triggerDelegate: `true` to trigger the `tableView:didSelectRowAt:` delegate from `UITableView` or `false` to skip it. Skipping it is the default `UITableView` behavior. - public func select(keyPath: KeyPath, animated: Bool = true, scrollPosition: UITableViewScrollPosition = .none, triggerDelegate: Bool = false) { + public func select(keyPath: KeyPath, animated: Bool = true, scrollPosition: UITableView.ScrollPosition = .none, triggerDelegate: Bool = false) { guard let aTableView = tableView, let indexPath = indexPathFromKeyPath(keyPath) else { return } if tableView(aTableView, willSelectRowAt: indexPath) != nil { aTableView.selectRow(at: indexPath, animated: animated, scrollPosition: scrollPosition) @@ -441,7 +441,7 @@ public class FunctionalTableData: NSObject { /// - keyPath: A key path identifying a row in the table view. /// - animated: `true` to animate to the new scroll position, or `false` to scroll immediately. /// - scrollPosition: Specifies where the item specified by `keyPath` should be positioned once scrolling finishes. - public func scroll(to keyPath: KeyPath, animated: Bool = true, scrollPosition: UITableViewScrollPosition = .bottom) { + public func scroll(to keyPath: KeyPath, animated: Bool = true, scrollPosition: UITableView.ScrollPosition = .bottom) { guard let aTableView = tableView, let indexPath = indexPathFromKeyPath(keyPath) else { return } aTableView.scrollToRow(at: indexPath, at: scrollPosition, animated: animated) } @@ -580,11 +580,11 @@ extension FunctionalTableData: UITableViewDelegate { } public func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { - guard indexPath.section < sections.count else { return UITableViewAutomaticDimension } + guard indexPath.section < sections.count else { return UITableView.automaticDimension } if let indexKeyPath = sections[indexPath.section].sectionKeyPathForRow(indexPath.row), let height = heightAtIndexKeyPath[indexKeyPath] { return height } else { - return UITableViewAutomaticDimension + return UITableView.automaticDimension } } @@ -715,7 +715,7 @@ extension FunctionalTableData: UITableViewDelegate { // required } - public func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCellEditingStyle { + public func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCell.EditingStyle { let cellConfig = sections[indexPath] return cellConfig?.actions.rowActions != nil ? .delete : .none } diff --git a/FunctionalTableData/TableView/TableCell.swift b/FunctionalTableData/TableView/TableCell.swift index 327659f..f6a35b4 100644 --- a/FunctionalTableData/TableView/TableCell.swift +++ b/FunctionalTableData/TableView/TableCell.swift @@ -11,7 +11,7 @@ import UIKit public class TableCell: UITableViewCell { public let view: ViewType public var prepare: ((_ view: ViewType) -> Void)? - public override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { view = ViewType() super.init(style: style, reuseIdentifier: reuseIdentifier) @@ -50,7 +50,7 @@ public class TableCell: UITableViewCe private extension UIAccessibilityElement { var isEmpty: Bool { return - accessibilityTraits == UIAccessibilityTraitStaticText && + accessibilityTraits == UIAccessibilityTraits.staticText && (accessibilityLabel == nil || accessibilityLabel!.isEmpty) && (accessibilityValue == nil || accessibilityValue!.isEmpty) && (accessibilityHint == nil || accessibilityHint!.isEmpty) diff --git a/FunctionalTableDataDemo/AppDelegate.swift b/FunctionalTableDataDemo/AppDelegate.swift index cb596af..297acaa 100644 --- a/FunctionalTableDataDemo/AppDelegate.swift +++ b/FunctionalTableDataDemo/AppDelegate.swift @@ -13,7 +13,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { return true }