Skip to content

Commit

Permalink
Merge pull request #129 from cocoahero/swift-4.2
Browse files Browse the repository at this point in the history
Swift 4.2 / Xcode 10 Compatibility
  • Loading branch information
dmiluski authored Sep 26, 2018
2 parents 30d5d58 + a2ae306 commit 3e79d4e
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.1
4.2.0
2 changes: 1 addition & 1 deletion Example/CustomTableViewCell.swift
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3e79d4e

Please sign in to comment.