Migrates to Swift 4 via Xcode migrator

This commit is contained in:
Riley Testut 2017-10-12 13:46:11 -07:00
parent df0c307be4
commit d709204107
10 changed files with 20 additions and 18 deletions

@ -1 +1 @@
Subproject commit 6e0ec5aedac746d1a5ea05d450884f1a9ad7b509 Subproject commit 97d29d5eaaf4bd2310464ca6d4f91a85dcbf4e2e

View File

@ -720,7 +720,7 @@
BFFA71D61AAC406100EE9DD1 = { BFFA71D61AAC406100EE9DD1 = {
CreatedOnToolsVersion = 6.3; CreatedOnToolsVersion = 6.3;
DevelopmentTeam = 6XVY5G3U44; DevelopmentTeam = 6XVY5G3U44;
LastSwiftMigration = 0800; LastSwiftMigration = 0900;
ProvisioningStyle = Automatic; ProvisioningStyle = Automatic;
SystemCapabilities = { SystemCapabilities = {
com.apple.iCloud = { com.apple.iCloud = {
@ -1098,7 +1098,8 @@
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Delta/Supporting Files/Delta-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Delta/Supporting Files/Delta-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0; SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
}; };
name = Debug; name = Debug;
}; };
@ -1119,7 +1120,8 @@
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Delta/Supporting Files/Delta-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Delta/Supporting Files/Delta-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0; SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
}; };
name = Release; name = Release;
}; };

View File

@ -79,7 +79,7 @@ extension AppDelegate
{ {
self.window?.tintColor = UIColor.deltaPurple self.window?.tintColor = UIColor.deltaPurple
UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).defaultTextAttributes[NSForegroundColorAttributeName] = UIColor.white UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).defaultTextAttributes[NSAttributedStringKey.foregroundColor] = UIColor.white
} }
} }

View File

@ -97,7 +97,7 @@ extension DatabaseManager
//MARK: - Preparation - //MARK: - Preparation -
private extension DatabaseManager private extension DatabaseManager
{ {
func prepareDatabase(completion: @escaping (Void) -> Void) func prepareDatabase(completion: @escaping () -> Void)
{ {
self.performBackgroundTask { (context) in self.performBackgroundTask { (context) in

View File

@ -18,7 +18,7 @@ internal extension UILabel
context.minimumScaleFactor = self.minimumScaleFactor context.minimumScaleFactor = self.minimumScaleFactor
// Using self.attributedString returns incorrect calculations, so we create our own attributed string // Using self.attributedString returns incorrect calculations, so we create our own attributed string
let attributedString = NSAttributedString(string: text, attributes: [NSFontAttributeName: self.font]) let attributedString = NSAttributedString(string: text, attributes: [NSAttributedStringKey.font: self.font])
attributedString.boundingRect(with: self.bounds.size, options: [.usesLineFragmentOrigin, .usesFontLeading], context: context) attributedString.boundingRect(with: self.bounds.size, options: [.usesLineFragmentOrigin, .usesFontLeading], context: context)
let scaleFactor = context.actualScaleFactor let scaleFactor = context.actualScaleFactor

View File

@ -61,7 +61,7 @@ class ImportController: NSObject
super.init() super.init()
} }
fileprivate func presentImportController(from presentingViewController: UIViewController, animated: Bool, completionHandler: ((Void) -> Void)?) fileprivate func presentImportController(from presentingViewController: UIViewController, animated: Bool, completionHandler: (() -> Void)?)
{ {
self.presentingViewController = presentingViewController self.presentingViewController = presentingViewController
@ -241,7 +241,7 @@ extension UIViewController
} }
} }
func present(_ importController: ImportController, animated: Bool, completion: ((Void) -> Void)?) func present(_ importController: ImportController, animated: Bool, completion: (() -> Void)?)
{ {
self.importController = importController self.importController = importController

View File

@ -44,7 +44,7 @@ extension CheatTextView
if let format = self.cheatFormat, let font = self.font if let format = self.cheatFormat, let font = self.font
{ {
let characterWidth = ("A" as NSString).size(attributes: [NSFontAttributeName: font]).width let characterWidth = ("A" as NSString).size(withAttributes: [NSAttributedStringKey.font: font]).width
let width = characterWidth * CGFloat(format.format.characters.count) let width = characterWidth * CGFloat(format.format.characters.count)
self.textContainer.size = CGSize(width: width, height: 0) self.textContainer.size = CGSize(width: width, height: 0)
@ -79,7 +79,7 @@ private extension CheatTextView
if let prefixString = prefixString, prefixString.length > 0 if let prefixString = prefixString, prefixString.length > 0
{ {
attributedString.addAttribute(CheatPrefixAttribute, value: prefixString, range: NSRange(location: 0, length: 1)) attributedString.addAttribute(NSAttributedStringKey(rawValue: CheatPrefixAttribute), value: prefixString, range: NSRange(location: 0, length: 1))
} }
attributedFormat.append(attributedString) attributedFormat.append(attributedString)
@ -105,7 +105,7 @@ private extension CheatTextView
extension CheatTextView: NSLayoutManagerDelegate extension CheatTextView: NSLayoutManagerDelegate
{ {
func layoutManager(_ layoutManager: NSLayoutManager, shouldGenerateGlyphs glyphs: UnsafePointer<CGGlyph>, properties props: UnsafePointer<NSGlyphProperty>, characterIndexes charIndexes: UnsafePointer<Int>, font aFont: UIFont, forGlyphRange glyphRange: NSRange) -> Int func layoutManager(_ layoutManager: NSLayoutManager, shouldGenerateGlyphs glyphs: UnsafePointer<CGGlyph>, properties props: UnsafePointer<NSLayoutManager.GlyphProperty>, characterIndexes charIndexes: UnsafePointer<Int>, font aFont: UIFont, forGlyphRange glyphRange: NSRange) -> Int
{ {
// Returning 0 = let the layoutManager do the normal logic // Returning 0 = let the layoutManager do the normal logic
guard let attributedFormat = self.attributedFormat else { return 0 } guard let attributedFormat = self.attributedFormat else { return 0 }
@ -118,7 +118,7 @@ extension CheatTextView: NSLayoutManagerDelegate
// Allocate our replacement buffers // Allocate our replacement buffers
let glyphBuffer = UnsafeMutablePointer<CGGlyph>.allocate(capacity: bufferSize) let glyphBuffer = UnsafeMutablePointer<CGGlyph>.allocate(capacity: bufferSize)
let propertyBuffer = UnsafeMutablePointer<NSGlyphProperty>.allocate(capacity: bufferSize) let propertyBuffer = UnsafeMutablePointer<NSLayoutManager.GlyphProperty>.allocate(capacity: bufferSize)
let characterBuffer = UnsafeMutablePointer<Int>.allocate(capacity: bufferSize) let characterBuffer = UnsafeMutablePointer<Int>.allocate(capacity: bufferSize)
var offset = 0 var offset = 0

View File

@ -325,7 +325,7 @@ private extension EditCheatViewController
sender.resignFirstResponder() sender.resignFirstResponder()
} }
func presentErrorAlert(title: String, message: String, handler: ((Void) -> Void)?) func presentErrorAlert(title: String, message: String, handler: (() -> Void)?)
{ {
DispatchQueue.main.async { DispatchQueue.main.async {
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert) let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)

View File

@ -174,7 +174,7 @@ private extension ControllersSettingsViewController
private extension ControllersSettingsViewController private extension ControllersSettingsViewController
{ {
dynamic func externalGameControllerDidConnect(_ notification: Notification) @objc dynamic func externalGameControllerDidConnect(_ notification: Notification)
{ {
guard let controller = notification.object as? GameController else { return } guard let controller = notification.object as? GameController else { return }
@ -217,7 +217,7 @@ private extension ControllersSettingsViewController
} }
} }
dynamic func externalGameControllerDidDisconnect(_ notification: Notification) @objc dynamic func externalGameControllerDidDisconnect(_ notification: Notification)
{ {
guard let controller = notification.object as? GameController else { return } guard let controller = notification.object as? GameController else { return }

View File

@ -153,12 +153,12 @@ private extension SettingsViewController
private extension SettingsViewController private extension SettingsViewController
{ {
dynamic func externalGameControllerDidConnect(_ notification: Notification) @objc dynamic func externalGameControllerDidConnect(_ notification: Notification)
{ {
self.tableView.reloadSections(IndexSet(integer: Section.controllers.rawValue), with: .none) self.tableView.reloadSections(IndexSet(integer: Section.controllers.rawValue), with: .none)
} }
dynamic func externalGameControllerDidDisconnect(_ notification: Notification) @objc dynamic func externalGameControllerDidDisconnect(_ notification: Notification)
{ {
self.tableView.reloadSections(IndexSet(integer: Section.controllers.rawValue), with: .none) self.tableView.reloadSections(IndexSet(integer: Section.controllers.rawValue), with: .none)
} }