Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift 4.2 / Xcode 10 Compatibility #129

Merged
merged 6 commits into from Sep 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .swift-version
@@ -1 +1 @@
3.0.1
4.2.0
2 changes: 1 addition & 1 deletion Example/CustomTableViewCell.swift
Expand Up @@ -16,7 +16,7 @@ final class CustomTableViewCell: UITableViewCell, Cell {

// MARK: - Initialization

override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
contentView.backgroundColor = .gray

Expand Down
2 changes: 1 addition & 1 deletion Example/WindowController.swift
Expand Up @@ -10,7 +10,7 @@ import UIKit


extension WindowController: UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
window?.makeKeyAndVisible()
return true
}
Expand Down
26 changes: 14 additions & 12 deletions Static.xcodeproj/project.pbxproj
Expand Up @@ -271,20 +271,20 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = Venmo;
TargetAttributes = {
21826AA91B3F51A100AA9641 = {
CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 0900;
LastSwiftMigration = 1000;
};
21826AB31B3F51A100AA9641 = {
CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 0900;
LastSwiftMigration = 1000;
};
36748D4E1B5034EC0046F207 = {
CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 0800;
LastSwiftMigration = 1000;
};
};
};
Expand Down Expand Up @@ -413,12 +413,14 @@
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;
Expand Down Expand Up @@ -470,12 +472,14 @@
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;
Expand Down Expand Up @@ -525,7 +529,7 @@
PRODUCT_NAME = Static;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -547,7 +551,7 @@
PRODUCT_NAME = Static;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand All @@ -558,8 +562,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.venmo.static.tests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -571,8 +574,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.venmo.static.tests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand All @@ -585,7 +587,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.venmo.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -599,7 +601,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.venmo.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
4 changes: 1 addition & 3 deletions Static.xcodeproj/xcshareddata/xcschemes/Example.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -46,7 +45,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
4 changes: 1 addition & 3 deletions Static.xcodeproj/xcshareddata/xcschemes/Static-iOS.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -56,7 +55,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
2 changes: 1 addition & 1 deletion Static/ButtonCell.swift
Expand Up @@ -4,7 +4,7 @@ open class ButtonCell: UITableViewCell, Cell {

// MARK: - Initializers

public override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: .default, reuseIdentifier: reuseIdentifier)
initialize()
}
Expand Down
6 changes: 3 additions & 3 deletions Static/DataSource.swift
Expand Up @@ -137,7 +137,7 @@ public class DataSource: NSObject {
let oldCount = oldSections.count
let newCount = sections.count
let delta = newCount - oldCount
let animation = UITableViewRowAnimation.automatic
let animation = UITableView.RowAnimation.automatic

tableView.beginUpdates()

Expand Down Expand Up @@ -306,11 +306,11 @@ extension DataSource: UITableViewDelegate {
}
}

extension UITableViewStyle {
extension UITableView.Style {
var defaultSectionExtremityHeight: CGFloat {
switch self {
case .plain: return 0
case .grouped: return UITableViewAutomaticDimension
case .grouped: return UITableView.automaticDimension
}
}
}
6 changes: 3 additions & 3 deletions Static/Row.swift
Expand Up @@ -37,7 +37,7 @@ public struct Row: Hashable, Equatable {
case view(UIView)

/// Table view cell accessory type
public var type: UITableViewCellAccessoryType {
public var type: UITableViewCell.AccessoryType {
switch self {
case .disclosureIndicator: return .disclosureIndicator
case .detailDisclosureButton(_): return .detailDisclosureButton
Expand Down Expand Up @@ -77,7 +77,7 @@ public struct Row: Hashable, Equatable {
public let title: String

/// Styling for button's action, used primarily for destructive actions.
public let style: UITableViewRowActionStyle
public let style: UITableViewRowAction.Style

/// Background color of the button.
public let backgroundColor: UIColor?
Expand All @@ -88,7 +88,7 @@ public struct Row: Hashable, Equatable {
/// Invoked when selecting the action.
public let selection: Selection?

public init(title: String, style: UITableViewRowActionStyle = .default, backgroundColor: UIColor? = nil, backgroundEffect: UIVisualEffect? = nil, selection: Selection? = nil) {
public init(title: String, style: UITableViewRowAction.Style = .default, backgroundColor: UIColor? = nil, backgroundEffect: UIVisualEffect? = nil, selection: Selection? = nil) {
self.title = title
self.style = style
self.backgroundColor = backgroundColor
Expand Down
2 changes: 1 addition & 1 deletion Static/Section.swift
Expand Up @@ -34,7 +34,7 @@ public struct Section: Hashable, Equatable {

var viewHeight: CGFloat {
switch self {
case .title(_), .autoLayoutView(_): return UITableViewAutomaticDimension
case .title(_), .autoLayoutView(_): return UITableView.automaticDimension
case .view(let view): return view.bounds.height
}
}
Expand Down
2 changes: 1 addition & 1 deletion Static/SubtitleCell.swift
@@ -1,7 +1,7 @@
import UIKit

open class SubtitleCell: UITableViewCell, Cell {
public override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: .subtitle, reuseIdentifier: reuseIdentifier)
}

Expand Down
4 changes: 2 additions & 2 deletions Static/TableViewController.swift
Expand Up @@ -6,7 +6,7 @@ open class TableViewController: UIViewController {
// MARK: - Properties

/// Returns the table view managed by the controller object.
open let tableView: UITableView
public let tableView: UITableView

/// A Boolean value indicating if the controller clears the selection when the table appears.
///
Expand All @@ -27,7 +27,7 @@ open class TableViewController: UIViewController {

// MARK: - Initialization

public init(style: UITableViewStyle) {
public init(style: UITableView.Style) {
tableView = UITableView(frame: .zero, style: style)
super.init(nibName: nil, bundle: nil)
dataSource.tableView = tableView
Expand Down
2 changes: 1 addition & 1 deletion Static/Tests/DataSourceTests.swift
Expand Up @@ -56,7 +56,7 @@ class DataSourceTests: XCTestCase {

XCTAssertEqual("Merrily", cell.textLabel!.text!)
XCTAssertEqual("merrily", cell.detailTextLabel!.text!)
XCTAssertEqual(UITableViewCellAccessoryType.disclosureIndicator, cell.accessoryType)
XCTAssertEqual(UITableViewCell.AccessoryType.disclosureIndicator, cell.accessoryType)
}

func testExtremityTitles() {
Expand Down
2 changes: 1 addition & 1 deletion Static/Value1Cell.swift
@@ -1,7 +1,7 @@
import UIKit

open class Value1Cell: UITableViewCell, Cell {
public override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: .value1, reuseIdentifier: reuseIdentifier)
}

Expand Down
2 changes: 1 addition & 1 deletion Static/Value2Cell.swift
@@ -1,7 +1,7 @@
import UIKit

open class Value2Cell: UITableViewCell, Cell {
public override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: .value2, reuseIdentifier: reuseIdentifier)
}

Expand Down