From 12a4acef617e49607c7b78703fd7a9dac6019b1d Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 5 Nov 2018 06:31:25 +0100 Subject: [PATCH] global: convert to Swift 4.2 --- WireGuard/WireGuard.xcodeproj/project.pbxproj | 2 ++ WireGuard/WireGuard/UI/iOS/AppDelegate.swift | 4 ++-- WireGuard/WireGuard/UI/iOS/CopyableLabelTableViewCell.swift | 2 +- .../WireGuard/UI/iOS/SettingsTableViewController.swift | 4 ++-- .../WireGuard/UI/iOS/TunnelDetailTableViewController.swift | 6 +++--- .../WireGuard/UI/iOS/TunnelEditTableViewController.swift | 6 +++--- .../WireGuard/UI/iOS/TunnelsListTableViewController.swift | 6 +++--- 7 files changed, 16 insertions(+), 14 deletions(-) diff --git a/WireGuard/WireGuard.xcodeproj/project.pbxproj b/WireGuard/WireGuard.xcodeproj/project.pbxproj index 69a1383..9ff9e77 100644 --- a/WireGuard/WireGuard.xcodeproj/project.pbxproj +++ b/WireGuard/WireGuard.xcodeproj/project.pbxproj @@ -751,6 +751,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "$(APP_ID)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "WireGuard/WireGuard-Bridging-Header.h"; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -770,6 +771,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "$(APP_ID)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "WireGuard/WireGuard-Bridging-Header.h"; + SWIFT_VERSION = 4.2; }; name = Release; }; diff --git a/WireGuard/WireGuard/UI/iOS/AppDelegate.swift b/WireGuard/WireGuard/UI/iOS/AppDelegate.swift index d7d1652..4e09650 100644 --- a/WireGuard/WireGuard/UI/iOS/AppDelegate.swift +++ b/WireGuard/WireGuard/UI/iOS/AppDelegate.swift @@ -11,7 +11,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var mainVC: MainViewController? func application(_ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { let window = UIWindow(frame: UIScreen.main.bounds) window.backgroundColor = UIColor.white @@ -26,7 +26,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { return true } - func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey: Any] = [:]) -> Bool { + func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { defer { do { try FileManager.default.removeItem(at: url) diff --git a/WireGuard/WireGuard/UI/iOS/CopyableLabelTableViewCell.swift b/WireGuard/WireGuard/UI/iOS/CopyableLabelTableViewCell.swift index ffe8d6f..daddf0a 100644 --- a/WireGuard/WireGuard/UI/iOS/CopyableLabelTableViewCell.swift +++ b/WireGuard/WireGuard/UI/iOS/CopyableLabelTableViewCell.swift @@ -14,7 +14,7 @@ class CopyableLabelTableViewCell: UITableViewCell { fatalError("init(coder:) has not been implemented") } - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) let gestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(handleTapGesture(_:))) self.addGestureRecognizer(gestureRecognizer) diff --git a/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift b/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift index 6bfad92..de7db2e 100644 --- a/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift @@ -172,7 +172,7 @@ class TunnelSettingsTableViewKeyValueCell: UITableViewCell { set(value) { detailTextLabel?.text = value } } - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: .value1, reuseIdentifier: TunnelSettingsTableViewKeyValueCell.id) } @@ -197,7 +197,7 @@ class TunnelSettingsTableViewButtonCell: UITableViewCell { let button: UIButton - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { button = UIButton(type: .system) super.init(style: style, reuseIdentifier: reuseIdentifier) contentView.addSubview(button) diff --git a/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift index 3165553..64aaa7b 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift @@ -227,7 +227,7 @@ class TunnelDetailTableViewStatusCell: UITableViewCell { let statusSwitch: UISwitch private var statusObservervationToken: AnyObject? - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { statusSwitch = UISwitch() super.init(style: .default, reuseIdentifier: TunnelDetailTableViewKeyValueCell.id) accessoryView = statusSwitch @@ -308,7 +308,7 @@ class TunnelDetailTableViewKeyValueCell: CopyableLabelTableViewCell { let valueLabel: UILabel let valueScroller: UIScrollView - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { keyLabel = UILabel() valueLabel = UILabel() valueScroller = UIScrollView() @@ -387,7 +387,7 @@ class TunnelDetailTableViewButtonCell: UITableViewCell { let button: UIButton var buttonStandardTintColor: UIColor - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { button = UIButton(type: .system) buttonStandardTintColor = button.tintColor super.init(style: style, reuseIdentifier: reuseIdentifier) diff --git a/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift index 37613c2..70b40b5 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift @@ -448,7 +448,7 @@ class TunnelEditTableViewKeyValueCell: CopyableLabelTableViewCell { private var textFieldValueOnBeginEditing: String = "" - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { keyLabel = UILabel() valueTextField = UITextField() super.init(style: style, reuseIdentifier: reuseIdentifier) @@ -539,7 +539,7 @@ class TunnelEditTableViewButtonCell: UITableViewCell { let button: UIButton var buttonStandardTintColor: UIColor - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { button = UIButton(type: .system) buttonStandardTintColor = button.tintColor super.init(style: style, reuseIdentifier: reuseIdentifier) @@ -590,7 +590,7 @@ class TunnelEditTableViewSwitchCell: UITableViewCell { let switchView: UISwitch - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { switchView = UISwitch() super.init(style: .default, reuseIdentifier: reuseIdentifier) accessoryView = switchView diff --git a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift index 48515e9..7e06bce 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift @@ -25,7 +25,7 @@ class TunnelsListTableViewController: UIViewController { self.navigationItem.leftBarButtonItem = settingsButtonItem // Set up the busy indicator - let busyIndicator = UIActivityIndicatorView(activityIndicatorStyle: .gray) + let busyIndicator = UIActivityIndicatorView(style: .gray) busyIndicator.hidesWhenStopped = true // Add the busyIndicator, centered @@ -386,9 +386,9 @@ class TunnelsListTableViewCell: UITableViewCell { private var statusObservervationToken: AnyObject? private var nameObservervationToken: AnyObject? - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { nameLabel = UILabel() - busyIndicator = UIActivityIndicatorView(activityIndicatorStyle: .gray) + busyIndicator = UIActivityIndicatorView(style: .gray) busyIndicator.hidesWhenStopped = true statusSwitch = UISwitch() super.init(style: style, reuseIdentifier: reuseIdentifier)