From 34dd09e7436d9c9b67cf4a3c0d36cfa398b53abf Mon Sep 17 00:00:00 2001 From: jeremymarch Date: Thu, 5 Sep 2019 22:45:24 -0400 Subject: [PATCH 1/3] Update code from Swift 3.0 to Swift 5.0. Update to recommended settings for xcode 10.3. --- HostingApp/AppDelegate.swift | 2 +- HostingApp/Background.jpg | Bin HostingApp/Base.lproj/Main.storyboard | 0 .../AppIcon.appiconset/Contents.json | 40 +++++++ .../LaunchImage.launchimage/Contents.json | 0 .../black-iphone5-portrait.png | Bin .../black-iphone6-portrait.png | Bin .../black-iphone6plus-portrait.png | Bin HostingApp/Info.plist | 0 HostingApp/ViewController.swift | 14 +-- Keyboard/Catboard.swift | 14 +-- Keyboard/CatboardBanner.swift | 4 +- Keyboard/DefaultKeyboard.swift | 0 Keyboard/DefaultSettings.swift | 42 +++---- Keyboard/DefaultSettings.xib | 0 Keyboard/DirectionEnum.swift | 0 Keyboard/ExtraView.swift | 0 Keyboard/ForwardingView.swift | 4 +- Keyboard/ImageKey.swift | 2 +- Keyboard/Info.plist | 0 Keyboard/KeyboardConnector.swift | 0 Keyboard/KeyboardInputTraits.swift | 4 +- Keyboard/KeyboardKey.swift | 2 +- Keyboard/KeyboardKeyBackground.swift | 0 Keyboard/KeyboardLayout.swift | 10 +- Keyboard/KeyboardModel.swift | 5 + Keyboard/KeyboardViewController.swift | 103 ++++++++++-------- .../gear.imageset/Contents.json | 0 .../Media.xcassets/gear.imageset/gear.png | Bin .../Media.xcassets/gear.imageset/gear@2x.png | Bin .../Media.xcassets/gear.imageset/gear@3x.png | Bin Keyboard/Shapes.swift | 0 Keyboard/Utilities.swift | 0 .../project.pbxproj | 32 ++++-- 34 files changed, 180 insertions(+), 98 deletions(-) mode change 100644 => 100755 HostingApp/AppDelegate.swift mode change 100644 => 100755 HostingApp/Background.jpg mode change 100644 => 100755 HostingApp/Base.lproj/Main.storyboard mode change 100644 => 100755 HostingApp/Images.xcassets/AppIcon.appiconset/Contents.json mode change 100644 => 100755 HostingApp/Images.xcassets/LaunchImage.launchimage/Contents.json mode change 100644 => 100755 HostingApp/Images.xcassets/LaunchImage.launchimage/black-iphone5-portrait.png mode change 100644 => 100755 HostingApp/Images.xcassets/LaunchImage.launchimage/black-iphone6-portrait.png mode change 100644 => 100755 HostingApp/Images.xcassets/LaunchImage.launchimage/black-iphone6plus-portrait.png mode change 100644 => 100755 HostingApp/Info.plist mode change 100644 => 100755 HostingApp/ViewController.swift mode change 100644 => 100755 Keyboard/Catboard.swift mode change 100644 => 100755 Keyboard/CatboardBanner.swift mode change 100644 => 100755 Keyboard/DefaultKeyboard.swift mode change 100644 => 100755 Keyboard/DefaultSettings.swift mode change 100644 => 100755 Keyboard/DefaultSettings.xib mode change 100644 => 100755 Keyboard/DirectionEnum.swift mode change 100644 => 100755 Keyboard/ExtraView.swift mode change 100644 => 100755 Keyboard/ForwardingView.swift mode change 100644 => 100755 Keyboard/ImageKey.swift mode change 100644 => 100755 Keyboard/Info.plist mode change 100644 => 100755 Keyboard/KeyboardConnector.swift mode change 100644 => 100755 Keyboard/KeyboardInputTraits.swift mode change 100644 => 100755 Keyboard/KeyboardKey.swift mode change 100644 => 100755 Keyboard/KeyboardKeyBackground.swift mode change 100644 => 100755 Keyboard/KeyboardLayout.swift mode change 100644 => 100755 Keyboard/KeyboardModel.swift mode change 100644 => 100755 Keyboard/KeyboardViewController.swift mode change 100644 => 100755 Keyboard/Media.xcassets/gear.imageset/Contents.json mode change 100644 => 100755 Keyboard/Media.xcassets/gear.imageset/gear.png mode change 100644 => 100755 Keyboard/Media.xcassets/gear.imageset/gear@2x.png mode change 100644 => 100755 Keyboard/Media.xcassets/gear.imageset/gear@3x.png mode change 100644 => 100755 Keyboard/Shapes.swift mode change 100644 => 100755 Keyboard/Utilities.swift mode change 100644 => 100755 TastyImitationKeyboard.xcodeproj/project.pbxproj diff --git a/HostingApp/AppDelegate.swift b/HostingApp/AppDelegate.swift old mode 100644 new mode 100755 index 9c4cef96..be7864d4 --- a/HostingApp/AppDelegate.swift +++ b/HostingApp/AppDelegate.swift @@ -14,7 +14,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 { // Override point for customization after application launch. return true } diff --git a/HostingApp/Background.jpg b/HostingApp/Background.jpg old mode 100644 new mode 100755 diff --git a/HostingApp/Base.lproj/Main.storyboard b/HostingApp/Base.lproj/Main.storyboard old mode 100644 new mode 100755 diff --git a/HostingApp/Images.xcassets/AppIcon.appiconset/Contents.json b/HostingApp/Images.xcassets/AppIcon.appiconset/Contents.json old mode 100644 new mode 100755 index b7f3352e..d8db8d65 --- a/HostingApp/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/HostingApp/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,15 +1,35 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "29x29", "scale" : "2x" }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "40x40", "scale" : "2x" }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "60x60", @@ -20,6 +40,16 @@ "size" : "60x60", "scale" : "3x" }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, { "idiom" : "ipad", "size" : "29x29", @@ -49,6 +79,16 @@ "idiom" : "ipad", "size" : "76x76", "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { diff --git a/HostingApp/Images.xcassets/LaunchImage.launchimage/Contents.json b/HostingApp/Images.xcassets/LaunchImage.launchimage/Contents.json old mode 100644 new mode 100755 diff --git a/HostingApp/Images.xcassets/LaunchImage.launchimage/black-iphone5-portrait.png b/HostingApp/Images.xcassets/LaunchImage.launchimage/black-iphone5-portrait.png old mode 100644 new mode 100755 diff --git a/HostingApp/Images.xcassets/LaunchImage.launchimage/black-iphone6-portrait.png b/HostingApp/Images.xcassets/LaunchImage.launchimage/black-iphone6-portrait.png old mode 100644 new mode 100755 diff --git a/HostingApp/Images.xcassets/LaunchImage.launchimage/black-iphone6plus-portrait.png b/HostingApp/Images.xcassets/LaunchImage.launchimage/black-iphone6plus-portrait.png old mode 100644 new mode 100755 diff --git a/HostingApp/Info.plist b/HostingApp/Info.plist old mode 100644 new mode 100755 diff --git a/HostingApp/ViewController.swift b/HostingApp/ViewController.swift old mode 100644 new mode 100755 index 1aeb8316..fcd9b201 --- a/HostingApp/ViewController.swift +++ b/HostingApp/ViewController.swift @@ -15,10 +15,10 @@ class HostingAppViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - NotificationCenter.default.addObserver(self, selector: #selector(HostingAppViewController.keyboardWillShow), name: NSNotification.Name.UIKeyboardWillShow, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(HostingAppViewController.keyboardDidHide), name: NSNotification.Name.UIKeyboardDidHide, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(HostingAppViewController.keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(HostingAppViewController.keyboardDidHide), name: UIResponder.keyboardDidHideNotification, object: nil) //NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("keyboardWillChangeFrame:"), name: UIKeyboardWillChangeFrameNotification, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(HostingAppViewController.keyboardDidChangeFrame(_:)), name: NSNotification.Name.UIKeyboardDidChangeFrame, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(HostingAppViewController.keyboardDidChangeFrame(_:)), name: UIResponder.keyboardDidChangeFrameNotification, object: nil) } override func didReceiveMemoryWarning() { @@ -38,13 +38,13 @@ class HostingAppViewController: UIViewController { var secondHeightTime: TimeInterval? var referenceHeight: CGFloat = 216 - func keyboardWillShow() { + @objc func keyboardWillShow() { if startTime == nil { startTime = CACurrentMediaTime() } } - func keyboardDidHide() { + @objc func keyboardDidHide() { startTime = nil firstHeightTime = nil secondHeightTime = nil @@ -52,9 +52,9 @@ class HostingAppViewController: UIViewController { self.stats?.text = "(Waiting for keyboard...)" } - func keyboardDidChangeFrame(_ notification: Notification) { + @objc func keyboardDidChangeFrame(_ notification: Notification) { //let frameBegin: CGRect! = notification.userInfo?[UIKeyboardFrameBeginUserInfoKey]?.CGRectValue - let frameEnd: CGRect! = (notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as AnyObject).cgRectValue + let frameEnd: CGRect! = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as AnyObject).cgRectValue if frameEnd.height == referenceHeight { if firstHeightTime == nil { diff --git a/Keyboard/Catboard.swift b/Keyboard/Catboard.swift old mode 100644 new mode 100755 index bfe9034e..f1849a4a --- a/Keyboard/Catboard.swift +++ b/Keyboard/Catboard.swift @@ -40,7 +40,7 @@ class Catboard: KeyboardViewController { if key.type == .character || key.type == .specialCharacter { if let context = textDocumentProxy.documentContextBeforeInput { - if context.characters.count < 2 { + if context.count < 2 { textDocumentProxy.insertText(keyOutput) return } @@ -99,11 +99,11 @@ class Catboard: KeyboardViewController { return CatboardBanner(globalColors: type(of: self).globalColors, darkMode: false, solidColorMode: self.solidColorMode()) } - func takeScreenshotDelay() { + @objc func takeScreenshotDelay() { Timer.scheduledTimer(timeInterval: 0.1, target: self, selector: #selector(Catboard.takeScreenshot), userInfo: nil, repeats: false) } - func takeScreenshot() { + @objc func takeScreenshot() { if !self.view.bounds.isEmpty { UIDevice.current.beginGeneratingDeviceOrientationNotifications() @@ -122,10 +122,10 @@ class Catboard: KeyboardViewController { //let orientation: UIInterfaceOrientation = screenSize.width < screenSize.height ? .portrait : .landscapeLeft //let name = (orientation.isPortrait ? "Screenshot-Portrait" : "Screenshot-Landscape") - let name = (self.interfaceOrientation.isPortrait ? "Screenshot-Portrait" : "Screenshot-Landscape") + let name = (self.isPortrait() ? "Screenshot-Portrait" : "Screenshot-Landscape") let imagePath = "/Users/archagon/Documents/Programming/OSX/RussianPhoneticKeyboard/External/tasty-imitation-keyboard/\(name).png" - if let pngRep = UIImagePNGRepresentation(capturedImage!) { + if let pngRep = capturedImage!.pngData() { try? pngRep.write(to: URL(fileURLWithPath: imagePath), options: [.atomic]) } @@ -137,10 +137,10 @@ class Catboard: KeyboardViewController { func randomCat() -> String { let cats = "πŸ±πŸ˜ΊπŸ˜ΈπŸ˜ΉπŸ˜½πŸ˜»πŸ˜ΏπŸ˜ΎπŸ˜ΌπŸ™€" - let numCats = cats.characters.count + let numCats = cats.count let randomCat = arc4random() % UInt32(numCats) - let index = cats.characters.index(cats.startIndex, offsetBy: Int(randomCat)) + let index = cats.index(cats.startIndex, offsetBy: Int(randomCat)) let character = cats[index] return String(character) diff --git a/Keyboard/CatboardBanner.swift b/Keyboard/CatboardBanner.swift old mode 100644 new mode 100755 index f15ae9d1..88fd7918 --- a/Keyboard/CatboardBanner.swift +++ b/Keyboard/CatboardBanner.swift @@ -26,7 +26,7 @@ class CatboardBanner: ExtraView { self.catSwitch.isOn = UserDefaults.standard.bool(forKey: kCatTypeEnabled) self.catSwitch.transform = CGAffineTransform(scaleX: 0.75, y: 0.75) - self.catSwitch.addTarget(self, action: #selector(CatboardBanner.respondToSwitch), for: UIControlEvents.valueChanged) + self.catSwitch.addTarget(self, action: #selector(CatboardBanner.respondToSwitch), for: UIControl.Event.valueChanged) self.updateAppearance() } @@ -47,7 +47,7 @@ class CatboardBanner: ExtraView { self.catLabel.frame.origin = CGPoint(x: self.catSwitch.frame.origin.x + self.catSwitch.frame.width + 8, y: self.catLabel.frame.origin.y) } - func respondToSwitch() { + @objc func respondToSwitch() { UserDefaults.standard.set(self.catSwitch.isOn, forKey: kCatTypeEnabled) self.updateAppearance() } diff --git a/Keyboard/DefaultKeyboard.swift b/Keyboard/DefaultKeyboard.swift old mode 100644 new mode 100755 diff --git a/Keyboard/DefaultSettings.swift b/Keyboard/DefaultSettings.swift old mode 100644 new mode 100755 index 63592172..611900c1 --- a/Keyboard/DefaultSettings.swift +++ b/Keyboard/DefaultSettings.swift @@ -74,10 +74,10 @@ class DefaultSettings: ExtraView, UITableViewDataSource, UITableViewDelegate { rootView.translatesAutoresizingMaskIntoConstraints = false self.addSubview(rootView) - let left = NSLayoutConstraint(item: rootView, attribute: NSLayoutAttribute.left, relatedBy: NSLayoutRelation.equal, toItem: self, attribute: NSLayoutAttribute.left, multiplier: 1, constant: 0) - let right = NSLayoutConstraint(item: rootView, attribute: NSLayoutAttribute.right, relatedBy: NSLayoutRelation.equal, toItem: self, attribute: NSLayoutAttribute.right, multiplier: 1, constant: 0) - let top = NSLayoutConstraint(item: rootView, attribute: NSLayoutAttribute.top, relatedBy: NSLayoutRelation.equal, toItem: self, attribute: NSLayoutAttribute.top, multiplier: 1, constant: 0) - let bottom = NSLayoutConstraint(item: rootView, attribute: NSLayoutAttribute.bottom, relatedBy: NSLayoutRelation.equal, toItem: self, attribute: NSLayoutAttribute.bottom, multiplier: 1, constant: 0) + let left = NSLayoutConstraint(item: rootView, attribute: NSLayoutConstraint.Attribute.left, relatedBy: NSLayoutConstraint.Relation.equal, toItem: self, attribute: NSLayoutConstraint.Attribute.left, multiplier: 1, constant: 0) + let right = NSLayoutConstraint(item: rootView, attribute: NSLayoutConstraint.Attribute.right, relatedBy: NSLayoutConstraint.Relation.equal, toItem: self, attribute: NSLayoutConstraint.Attribute.right, multiplier: 1, constant: 0) + let top = NSLayoutConstraint(item: rootView, attribute: NSLayoutConstraint.Attribute.top, relatedBy: NSLayoutConstraint.Relation.equal, toItem: self, attribute: NSLayoutConstraint.Attribute.top, multiplier: 1, constant: 0) + let bottom = NSLayoutConstraint(item: rootView, attribute: NSLayoutConstraint.Attribute.bottom, relatedBy: NSLayoutConstraint.Relation.equal, toItem: self, attribute: NSLayoutConstraint.Attribute.bottom, multiplier: 1, constant: 0) self.addConstraint(left) self.addConstraint(right) @@ -88,7 +88,7 @@ class DefaultSettings: ExtraView, UITableViewDataSource, UITableViewDelegate { self.tableView?.register(DefaultSettingsTableViewCell.self, forCellReuseIdentifier: "cell") self.tableView?.estimatedRowHeight = 44; - self.tableView?.rowHeight = UITableViewAutomaticDimension; + self.tableView?.rowHeight = UITableView.automaticDimension; // XXX: this is here b/c a totally transparent background does not support scrolling in blank areas self.tableView?.backgroundColor = UIColor.white.withAlphaComponent(0.01) @@ -126,7 +126,7 @@ class DefaultSettings: ExtraView, UITableViewDataSource, UITableViewDelegate { let key = self.settingsList[indexPath.section].1[indexPath.row] if cell.sw.allTargets.count == 0 { - cell.sw.addTarget(self, action: #selector(DefaultSettings.toggleSetting(_:)), for: UIControlEvents.valueChanged) + cell.sw.addTarget(self, action: #selector(DefaultSettings.toggleSetting(_:)), for: UIControl.Event.valueChanged) } cell.sw.isOn = UserDefaults.standard.bool(forKey: key) @@ -183,7 +183,7 @@ class DefaultSettings: ExtraView, UITableViewDataSource, UITableViewDelegate { } } - func toggleSetting(_ sender: UISwitch) { + @objc func toggleSetting(_ sender: UISwitch) { if let cell = sender.superview as? UITableViewCell { if let indexPath = self.tableView?.indexPath(for: cell) { let key = self.settingsList[indexPath.section].1[indexPath.row] @@ -201,7 +201,7 @@ class DefaultSettingsTableViewCell: UITableViewCell { var constraintsSetForLongLabel: Bool var cellConstraints: [NSLayoutConstraint] - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { self.sw = UISwitch() self.label = UILabel() self.longLabel = UITextView() @@ -241,20 +241,20 @@ class DefaultSettingsTableViewCell: UITableViewCell { let hasLongText = self.longLabel.text != nil && !self.longLabel.text.isEmpty if hasLongText { - let switchSide = NSLayoutConstraint(item: sw, attribute: NSLayoutAttribute.right, relatedBy: NSLayoutRelation.equal, toItem: self, attribute: NSLayoutAttribute.right, multiplier: 1, constant: -sideMargin) - let switchTop = NSLayoutConstraint(item: sw, attribute: NSLayoutAttribute.top, relatedBy: NSLayoutRelation.equal, toItem: self, attribute: NSLayoutAttribute.top, multiplier: 1, constant: margin) - let labelSide = NSLayoutConstraint(item: label, attribute: NSLayoutAttribute.left, relatedBy: NSLayoutRelation.equal, toItem: self, attribute: NSLayoutAttribute.left, multiplier: 1, constant: sideMargin) - let labelCenter = NSLayoutConstraint(item: label, attribute: NSLayoutAttribute.centerY, relatedBy: NSLayoutRelation.equal, toItem: sw, attribute: NSLayoutAttribute.centerY, multiplier: 1, constant: 0) + let switchSide = NSLayoutConstraint(item: sw, attribute: NSLayoutConstraint.Attribute.right, relatedBy: NSLayoutConstraint.Relation.equal, toItem: self, attribute: NSLayoutConstraint.Attribute.right, multiplier: 1, constant: -sideMargin) + let switchTop = NSLayoutConstraint(item: sw, attribute: NSLayoutConstraint.Attribute.top, relatedBy: NSLayoutConstraint.Relation.equal, toItem: self, attribute: NSLayoutConstraint.Attribute.top, multiplier: 1, constant: margin) + let labelSide = NSLayoutConstraint(item: label, attribute: NSLayoutConstraint.Attribute.left, relatedBy: NSLayoutConstraint.Relation.equal, toItem: self, attribute: NSLayoutConstraint.Attribute.left, multiplier: 1, constant: sideMargin) + let labelCenter = NSLayoutConstraint(item: label, attribute: NSLayoutConstraint.Attribute.centerY, relatedBy: NSLayoutConstraint.Relation.equal, toItem: sw, attribute: NSLayoutConstraint.Attribute.centerY, multiplier: 1, constant: 0) self.addConstraint(switchSide) self.addConstraint(switchTop) self.addConstraint(labelSide) self.addConstraint(labelCenter) - let left = NSLayoutConstraint(item: longLabel, attribute: NSLayoutAttribute.left, relatedBy: NSLayoutRelation.equal, toItem: self, attribute: NSLayoutAttribute.left, multiplier: 1, constant: sideMargin) - let right = NSLayoutConstraint(item: longLabel, attribute: NSLayoutAttribute.right, relatedBy: NSLayoutRelation.equal, toItem: self, attribute: NSLayoutAttribute.right, multiplier: 1, constant: -sideMargin) - let top = NSLayoutConstraint(item: longLabel, attribute: NSLayoutAttribute.top, relatedBy: NSLayoutRelation.equal, toItem: sw, attribute: NSLayoutAttribute.bottom, multiplier: 1, constant: margin) - let bottom = NSLayoutConstraint(item: longLabel, attribute: NSLayoutAttribute.bottom, relatedBy: NSLayoutRelation.equal, toItem: self, attribute: NSLayoutAttribute.bottom, multiplier: 1, constant: -margin) + let left = NSLayoutConstraint(item: longLabel, attribute: NSLayoutConstraint.Attribute.left, relatedBy: NSLayoutConstraint.Relation.equal, toItem: self, attribute: NSLayoutConstraint.Attribute.left, multiplier: 1, constant: sideMargin) + let right = NSLayoutConstraint(item: longLabel, attribute: NSLayoutConstraint.Attribute.right, relatedBy: NSLayoutConstraint.Relation.equal, toItem: self, attribute: NSLayoutConstraint.Attribute.right, multiplier: 1, constant: -sideMargin) + let top = NSLayoutConstraint(item: longLabel, attribute: NSLayoutConstraint.Attribute.top, relatedBy: NSLayoutConstraint.Relation.equal, toItem: sw, attribute: NSLayoutConstraint.Attribute.bottom, multiplier: 1, constant: margin) + let bottom = NSLayoutConstraint(item: longLabel, attribute: NSLayoutConstraint.Attribute.bottom, relatedBy: NSLayoutConstraint.Relation.equal, toItem: self, attribute: NSLayoutConstraint.Attribute.bottom, multiplier: 1, constant: -margin) self.addConstraint(left) self.addConstraint(right) @@ -266,11 +266,11 @@ class DefaultSettingsTableViewCell: UITableViewCell { self.constraintsSetForLongLabel = true } else { - let switchSide = NSLayoutConstraint(item: sw, attribute: NSLayoutAttribute.right, relatedBy: NSLayoutRelation.equal, toItem: self, attribute: NSLayoutAttribute.right, multiplier: 1, constant: -sideMargin) - let switchTop = NSLayoutConstraint(item: sw, attribute: NSLayoutAttribute.top, relatedBy: NSLayoutRelation.equal, toItem: self, attribute: NSLayoutAttribute.top, multiplier: 1, constant: margin) - let switchBottom = NSLayoutConstraint(item: sw, attribute: NSLayoutAttribute.bottom, relatedBy: NSLayoutRelation.equal, toItem: self, attribute: NSLayoutAttribute.bottom, multiplier: 1, constant: -margin) - let labelSide = NSLayoutConstraint(item: label, attribute: NSLayoutAttribute.left, relatedBy: NSLayoutRelation.equal, toItem: self, attribute: NSLayoutAttribute.left, multiplier: 1, constant: sideMargin) - let labelCenter = NSLayoutConstraint(item: label, attribute: NSLayoutAttribute.centerY, relatedBy: NSLayoutRelation.equal, toItem: sw, attribute: NSLayoutAttribute.centerY, multiplier: 1, constant: 0) + let switchSide = NSLayoutConstraint(item: sw, attribute: NSLayoutConstraint.Attribute.right, relatedBy: NSLayoutConstraint.Relation.equal, toItem: self, attribute: NSLayoutConstraint.Attribute.right, multiplier: 1, constant: -sideMargin) + let switchTop = NSLayoutConstraint(item: sw, attribute: NSLayoutConstraint.Attribute.top, relatedBy: NSLayoutConstraint.Relation.equal, toItem: self, attribute: NSLayoutConstraint.Attribute.top, multiplier: 1, constant: margin) + let switchBottom = NSLayoutConstraint(item: sw, attribute: NSLayoutConstraint.Attribute.bottom, relatedBy: NSLayoutConstraint.Relation.equal, toItem: self, attribute: NSLayoutConstraint.Attribute.bottom, multiplier: 1, constant: -margin) + let labelSide = NSLayoutConstraint(item: label, attribute: NSLayoutConstraint.Attribute.left, relatedBy: NSLayoutConstraint.Relation.equal, toItem: self, attribute: NSLayoutConstraint.Attribute.left, multiplier: 1, constant: sideMargin) + let labelCenter = NSLayoutConstraint(item: label, attribute: NSLayoutConstraint.Attribute.centerY, relatedBy: NSLayoutConstraint.Relation.equal, toItem: sw, attribute: NSLayoutConstraint.Attribute.centerY, multiplier: 1, constant: 0) self.addConstraint(switchSide) self.addConstraint(switchTop) diff --git a/Keyboard/DefaultSettings.xib b/Keyboard/DefaultSettings.xib old mode 100644 new mode 100755 diff --git a/Keyboard/DirectionEnum.swift b/Keyboard/DirectionEnum.swift old mode 100644 new mode 100755 diff --git a/Keyboard/ExtraView.swift b/Keyboard/ExtraView.swift old mode 100644 new mode 100755 diff --git a/Keyboard/ForwardingView.swift b/Keyboard/ForwardingView.swift old mode 100644 new mode 100755 index 5706487a..c4e90d5b --- a/Keyboard/ForwardingView.swift +++ b/Keyboard/ForwardingView.swift @@ -15,7 +15,7 @@ class ForwardingView: UIView { override init(frame: CGRect) { super.init(frame: frame) - self.contentMode = UIViewContentMode.redraw + self.contentMode = UIView.ContentMode.redraw self.isMultipleTouchEnabled = true self.isUserInteractionEnabled = true self.isOpaque = false @@ -40,7 +40,7 @@ class ForwardingView: UIView { } } - func handleControl(_ view: UIView?, controlEvent: UIControlEvents) { + func handleControl(_ view: UIView?, controlEvent: UIControl.Event) { if let control = view as? UIControl { let targets = control.allTargets for target in targets { diff --git a/Keyboard/ImageKey.swift b/Keyboard/ImageKey.swift old mode 100644 new mode 100755 index 436432fd..d245db3d --- a/Keyboard/ImageKey.swift +++ b/Keyboard/ImageKey.swift @@ -18,7 +18,7 @@ class ImageKey: KeyboardKey { didSet { if let imageView = image { self.addSubview(imageView) - imageView.contentMode = UIViewContentMode.scaleAspectFit + imageView.contentMode = UIView.ContentMode.scaleAspectFit self.redrawImage() updateColors() } diff --git a/Keyboard/Info.plist b/Keyboard/Info.plist old mode 100644 new mode 100755 diff --git a/Keyboard/KeyboardConnector.swift b/Keyboard/KeyboardConnector.swift old mode 100644 new mode 100755 diff --git a/Keyboard/KeyboardInputTraits.swift b/Keyboard/KeyboardInputTraits.swift old mode 100644 new mode 100755 index 5b2ada50..1cf9fcba --- a/Keyboard/KeyboardInputTraits.swift +++ b/Keyboard/KeyboardInputTraits.swift @@ -25,10 +25,10 @@ extension KeyboardViewController { // note that KVO doesn't work on textDocumentProxy, so we have to poll traitPollingTimer?.invalidate() traitPollingTimer = UIScreen.main.displayLink(withTarget: self, selector: #selector(KeyboardViewController.pollTraits)) - traitPollingTimer?.add(to: RunLoop.current, forMode: RunLoopMode.defaultRunLoopMode) + traitPollingTimer?.add(to: RunLoop.current, forMode: RunLoop.Mode.default) } - func pollTraits() { + @objc func pollTraits() { let proxy = self.textDocumentProxy if let layout = self.layout { diff --git a/Keyboard/KeyboardKey.swift b/Keyboard/KeyboardKey.swift old mode 100644 new mode 100755 index 58ddffbe..a72b063e --- a/Keyboard/KeyboardKey.swift +++ b/Keyboard/KeyboardKey.swift @@ -450,7 +450,7 @@ class KeyboardKey: UIControl { } } - func hidePopup() { + @objc func hidePopup() { if self.popup != nil { self.delegate?.willHidePopup(for: self) diff --git a/Keyboard/KeyboardKeyBackground.swift b/Keyboard/KeyboardKeyBackground.swift old mode 100644 new mode 100755 diff --git a/Keyboard/KeyboardLayout.swift b/Keyboard/KeyboardLayout.swift old mode 100644 new mode 100755 index a90b545a..872ec4c5 --- a/Keyboard/KeyboardLayout.swift +++ b/Keyboard/KeyboardLayout.swift @@ -235,6 +235,10 @@ extension CGRect: Hashable { return (origin.x.hashValue ^ origin.y.hashValue ^ size.width.hashValue ^ size.height.hashValue) } } + public func hash(into hasher: inout Hasher) + { + hasher.combine(self.hashValue) + } } extension CGSize: Hashable { @@ -243,6 +247,10 @@ extension CGSize: Hashable { return (width.hashValue ^ height.hashValue) } } + public func hash(into hasher: inout Hasher) + { + hasher.combine(self.hashValue) + } } // handles the layout for the keyboard, including key spacing and arrangement @@ -610,7 +618,7 @@ class KeyboardLayout: NSObject, KeyboardKeyProtocol { } } - let id = "p\(p)r\(r)k\(k)" + let id = "p\(String(describing: p))r\(String(describing: r))k\(String(describing: k))" if let key = self.nonPooledMap[id] { return key } diff --git a/Keyboard/KeyboardModel.swift b/Keyboard/KeyboardModel.swift old mode 100644 new mode 100755 index 349d460e..097c5de1 --- a/Keyboard/KeyboardModel.swift +++ b/Keyboard/KeyboardModel.swift @@ -127,6 +127,11 @@ class Key: Hashable { counter += 1 } + func hash(into hasher: inout Hasher) + { + hasher.combine(self.hashValue) + } + convenience init(_ key: Key) { self.init(key.type) diff --git a/Keyboard/KeyboardViewController.swift b/Keyboard/KeyboardViewController.swift old mode 100644 new mode 100755 index 45cbc687..9460a50f --- a/Keyboard/KeyboardViewController.swift +++ b/Keyboard/KeyboardViewController.swift @@ -24,7 +24,6 @@ class KeyboardViewController: UIInputViewController { let backspaceDelay: TimeInterval = 0.5 let backspaceRepeat: TimeInterval = 0.07 - var keyboard: Keyboard! var forwardingView: ForwardingView! var layout: KeyboardLayout? @@ -125,7 +124,7 @@ class KeyboardViewController: UIInputViewController { NotificationCenter.default.removeObserver(self) } - func defaultsChanged(_ notification: Notification) { + @objc func defaultsChanged(_ notification: Notification) { //let defaults = notification.object as? NSUserDefaults self.updateKeyCaps(self.shiftState.uppercase()) } @@ -139,10 +138,10 @@ class KeyboardViewController: UIInputViewController { kludge.translatesAutoresizingMaskIntoConstraints = false kludge.isHidden = true - let a = NSLayoutConstraint(item: kludge, attribute: NSLayoutAttribute.left, relatedBy: NSLayoutRelation.equal, toItem: self.view, attribute: NSLayoutAttribute.left, multiplier: 1, constant: 0) - let b = NSLayoutConstraint(item: kludge, attribute: NSLayoutAttribute.right, relatedBy: NSLayoutRelation.equal, toItem: self.view, attribute: NSLayoutAttribute.left, multiplier: 1, constant: 0) - let c = NSLayoutConstraint(item: kludge, attribute: NSLayoutAttribute.top, relatedBy: NSLayoutRelation.equal, toItem: self.view, attribute: NSLayoutAttribute.top, multiplier: 1, constant: 0) - let d = NSLayoutConstraint(item: kludge, attribute: NSLayoutAttribute.bottom, relatedBy: NSLayoutRelation.equal, toItem: self.view, attribute: NSLayoutAttribute.top, multiplier: 1, constant: 0) + let a = NSLayoutConstraint(item: kludge, attribute: NSLayoutConstraint.Attribute.left, relatedBy: NSLayoutConstraint.Relation.equal, toItem: self.view, attribute: NSLayoutConstraint.Attribute.left, multiplier: 1, constant: 0) + let b = NSLayoutConstraint(item: kludge, attribute: NSLayoutConstraint.Attribute.right, relatedBy: NSLayoutConstraint.Relation.equal, toItem: self.view, attribute: NSLayoutConstraint.Attribute.left, multiplier: 1, constant: 0) + let c = NSLayoutConstraint(item: kludge, attribute: NSLayoutConstraint.Attribute.top, relatedBy: NSLayoutConstraint.Relation.equal, toItem: self.view, attribute: NSLayoutConstraint.Attribute.top, multiplier: 1, constant: 0) + let d = NSLayoutConstraint(item: kludge, attribute: NSLayoutConstraint.Attribute.bottom, relatedBy: NSLayoutConstraint.Relation.equal, toItem: self.view, attribute: NSLayoutConstraint.Attribute.top, multiplier: 1, constant: 0) self.view.addConstraints([a, b, c, d]) self.kludge = kludge @@ -199,7 +198,19 @@ class KeyboardViewController: UIInputViewController { } func solidColorMode() -> Bool { - return UIAccessibilityIsReduceTransparencyEnabled() + return UIAccessibility.isReduceTransparencyEnabled + } + + func isPortrait() -> Bool + { + let size = UIScreen.main.bounds.size + if size.width > size.height { + //print("Landscape: \(size.width) X \(size.height)") + return false + } else { + //print("Portrait: \(size.width) X \(size.height)") + return true + } } var lastLayoutBounds: CGRect? @@ -210,7 +221,7 @@ class KeyboardViewController: UIInputViewController { self.setupLayout() - let orientationSavvyBounds = CGRect(x: 0, y: 0, width: self.view.bounds.width, height: self.height(forOrientation: self.interfaceOrientation, withTopBanner: false)) + let orientationSavvyBounds = CGRect(x: 0, y: 0, width: self.view.bounds.width, height: self.height(orientationIsPortrait: self.isPortrait(), withTopBanner: false)) if (lastLayoutBounds != nil && lastLayoutBounds == orientationSavvyBounds) { // do nothing @@ -243,7 +254,7 @@ class KeyboardViewController: UIInputViewController { override func viewWillAppear(_ animated: Bool) { self.bannerView?.isHidden = false - self.keyboardHeight = self.height(forOrientation: self.interfaceOrientation, withTopBanner: true) + self.keyboardHeight = self.height(orientationIsPortrait: self.isPortrait(), withTopBanner: true) } override func willRotate(to toInterfaceOrientation: UIInterfaceOrientation, duration: TimeInterval) { @@ -258,7 +269,7 @@ class KeyboardViewController: UIInputViewController { } } - self.keyboardHeight = self.height(forOrientation: toInterfaceOrientation, withTopBanner: true) + self.keyboardHeight = self.height(orientationIsPortrait: self.isPortrait(), withTopBanner: true) } override func didRotate(from fromInterfaceOrientation: UIInterfaceOrientation) { @@ -270,7 +281,7 @@ class KeyboardViewController: UIInputViewController { } } - func height(forOrientation orientation: UIInterfaceOrientation, withTopBanner: Bool) -> CGFloat { + func height(orientationIsPortrait isPortrait: Bool, withTopBanner: Bool) -> CGFloat { let isPad = UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.pad // AB: consider re-enabling this when interfaceOrientation actually breaks @@ -287,13 +298,13 @@ class KeyboardViewController: UIInputViewController { canonicalLandscapeHeight = 352 } else { - canonicalPortraitHeight = orientation.isPortrait && actualScreenWidth >= 400 ? 226 : 216 + canonicalPortraitHeight = isPortrait && actualScreenWidth >= 400 ? 226 : 216 canonicalLandscapeHeight = 162 } let topBannerHeight = (withTopBanner ? metric("topBanner") : 0) - return CGFloat(orientation.isPortrait ? canonicalPortraitHeight + topBannerHeight : canonicalLandscapeHeight + topBannerHeight) + return CGFloat(isPortrait ? canonicalPortraitHeight + topBannerHeight : canonicalLandscapeHeight + topBannerHeight) } /* @@ -315,7 +326,7 @@ class KeyboardViewController: UIInputViewController { for rowKeys in page.rows { // TODO: quick hack for key in rowKeys { if let keyView = self.layout?.viewForKey(key) { - keyView.removeTarget(nil, action: nil, for: UIControlEvents.allEvents) + keyView.removeTarget(nil, action: nil, for: UIControl.Event.allEvents) switch key.type { case Key.KeyType.keyboardChange: @@ -323,7 +334,7 @@ class KeyboardViewController: UIInputViewController { action: #selector(KeyboardViewController.advanceTapped(_:)), for: .touchUpInside) case Key.KeyType.backspace: - let cancelEvents: UIControlEvents = [UIControlEvents.touchUpInside, UIControlEvents.touchUpInside, UIControlEvents.touchDragExit, UIControlEvents.touchUpOutside, UIControlEvents.touchCancel, UIControlEvents.touchDragOutside] + let cancelEvents: UIControl.Event = [UIControl.Event.touchUpInside, UIControl.Event.touchUpInside, UIControl.Event.touchDragExit, UIControl.Event.touchUpOutside, UIControl.Event.touchCancel, UIControl.Event.touchDragOutside] keyView.addTarget(self, action: #selector(KeyboardViewController.backspaceDown(_:)), @@ -398,14 +409,14 @@ class KeyboardViewController: UIInputViewController { var keyWithDelayedPopup: KeyboardKey? var popupDelayTimer: Timer? - func showPopup(_ sender: KeyboardKey) { + @objc func showPopup(_ sender: KeyboardKey) { if sender == self.keyWithDelayedPopup { self.popupDelayTimer?.invalidate() } sender.showPopup() } - func hidePopupDelay(_ sender: KeyboardKey) { + @objc func hidePopupDelay(_ sender: KeyboardKey) { self.popupDelayTimer?.invalidate() if sender != self.keyWithDelayedPopup { @@ -418,7 +429,7 @@ class KeyboardViewController: UIInputViewController { } } - func hidePopupCallback() { + @objc func hidePopupCallback() { self.keyWithDelayedPopup?.hidePopup() self.keyWithDelayedPopup = nil self.popupDelayTimer = nil @@ -446,14 +457,14 @@ class KeyboardViewController: UIInputViewController { func setHeight(_ height: CGFloat) { if self.heightConstraint == nil { self.heightConstraint = NSLayoutConstraint( - item:self.view, - attribute:NSLayoutAttribute.height, - relatedBy:NSLayoutRelation.equal, + item:self.view!, + attribute:NSLayoutConstraint.Attribute.height, + relatedBy:NSLayoutConstraint.Relation.equal, toItem:nil, - attribute:NSLayoutAttribute.notAnAttribute, + attribute:NSLayoutConstraint.Attribute.notAnAttribute, multiplier:0, constant:height) - self.heightConstraint!.priority = 1000 + self.heightConstraint!.priority = UILayoutPriority(rawValue: 1000) self.view.addConstraint(self.heightConstraint!) // TODO: what if view already has constraint added? } @@ -471,15 +482,15 @@ class KeyboardViewController: UIInputViewController { self.settingsView?.darkMode = appearanceIsDark } - func highlightKey(_ sender: KeyboardKey) { + @objc func highlightKey(_ sender: KeyboardKey) { sender.isHighlighted = true } - func unHighlightKey(_ sender: KeyboardKey) { + @objc func unHighlightKey(_ sender: KeyboardKey) { sender.isHighlighted = false } - func keyPressedHelper(_ sender: KeyboardKey) { + @objc func keyPressedHelper(_ sender: KeyboardKey) { if let model = self.layout?.keyForView(sender) { self.keyPressed(model) @@ -518,7 +529,7 @@ class KeyboardViewController: UIInputViewController { let charactersAreInCorrectState = { () -> Bool in let previousContext = self.textDocumentProxy.documentContextBeforeInput - if previousContext == nil || (previousContext!).characters.count < 3 { + if previousContext == nil || (previousContext!).count < 3 { return false } @@ -566,7 +577,7 @@ class KeyboardViewController: UIInputViewController { self.backspaceRepeatTimer = nil } - func backspaceDown(_ sender: KeyboardKey) { + @objc func backspaceDown(_ sender: KeyboardKey) { self.cancelBackspaceTimers() self.textDocumentProxy.deleteBackward() @@ -576,23 +587,23 @@ class KeyboardViewController: UIInputViewController { self.backspaceDelayTimer = Timer.scheduledTimer(timeInterval: backspaceDelay - backspaceRepeat, target: self, selector: #selector(KeyboardViewController.backspaceDelayCallback), userInfo: nil, repeats: false) } - func backspaceUp(_ sender: KeyboardKey) { + @objc func backspaceUp(_ sender: KeyboardKey) { self.cancelBackspaceTimers() } - func backspaceDelayCallback() { + @objc func backspaceDelayCallback() { self.backspaceDelayTimer = nil self.backspaceRepeatTimer = Timer.scheduledTimer(timeInterval: backspaceRepeat, target: self, selector: #selector(KeyboardViewController.backspaceRepeatCallback), userInfo: nil, repeats: true) } - func backspaceRepeatCallback() { + @objc func backspaceRepeatCallback() { self.playKeySound() self.textDocumentProxy.deleteBackward() self.updateCapsIfNeeded() } - func shiftDown(_ sender: KeyboardKey) { + @objc func shiftDown(_ sender: KeyboardKey) { self.shiftStartingState = self.shiftState if let shiftStartingState = self.shiftStartingState { @@ -615,7 +626,7 @@ class KeyboardViewController: UIInputViewController { } } - func shiftUp(_ sender: KeyboardKey) { + @objc func shiftUp(_ sender: KeyboardKey) { if self.shiftWasMultitapped { // do nothing } @@ -643,7 +654,7 @@ class KeyboardViewController: UIInputViewController { self.shiftWasMultitapped = false } - func shiftDoubleTapped(_ sender: KeyboardKey) { + @objc func shiftDoubleTapped(_ sender: KeyboardKey) { self.shiftWasMultitapped = true switch self.shiftState { @@ -661,7 +672,7 @@ class KeyboardViewController: UIInputViewController { self.layout?.updateKeyCaps(false, uppercase: uppercase, characterUppercase: characterUppercase, shiftState: self.shiftState) } - func modeChangeTapped(_ sender: KeyboardKey) { + @objc func modeChangeTapped(_ sender: KeyboardKey) { if let toMode = self.layout?.viewToModel[sender]?.toMode { self.currentMode = toMode } @@ -679,7 +690,7 @@ class KeyboardViewController: UIInputViewController { self.setupKeys() } - func advanceTapped(_ sender: KeyboardKey) { + @objc func advanceTapped(_ sender: KeyboardKey) { self.forwardingView.resetTrackedViews() self.shiftStartingState = nil self.shiftWasMultitapped = false @@ -699,10 +710,10 @@ class KeyboardViewController: UIInputViewController { aSettings.translatesAutoresizingMaskIntoConstraints = false - let widthConstraint = NSLayoutConstraint(item: aSettings, attribute: NSLayoutAttribute.width, relatedBy: NSLayoutRelation.equal, toItem: self.view, attribute: NSLayoutAttribute.width, multiplier: 1, constant: 0) - let heightConstraint = NSLayoutConstraint(item: aSettings, attribute: NSLayoutAttribute.height, relatedBy: NSLayoutRelation.equal, toItem: self.view, attribute: NSLayoutAttribute.height, multiplier: 1, constant: 0) - let centerXConstraint = NSLayoutConstraint(item: aSettings, attribute: NSLayoutAttribute.centerX, relatedBy: NSLayoutRelation.equal, toItem: self.view, attribute: NSLayoutAttribute.centerX, multiplier: 1, constant: 0) - let centerYConstraint = NSLayoutConstraint(item: aSettings, attribute: NSLayoutAttribute.centerY, relatedBy: NSLayoutRelation.equal, toItem: self.view, attribute: NSLayoutAttribute.centerY, multiplier: 1, constant: 0) + let widthConstraint = NSLayoutConstraint(item: aSettings, attribute: NSLayoutConstraint.Attribute.width, relatedBy: NSLayoutConstraint.Relation.equal, toItem: self.view, attribute: NSLayoutConstraint.Attribute.width, multiplier: 1, constant: 0) + let heightConstraint = NSLayoutConstraint(item: aSettings, attribute: NSLayoutConstraint.Attribute.height, relatedBy: NSLayoutConstraint.Relation.equal, toItem: self.view, attribute: NSLayoutConstraint.Attribute.height, multiplier: 1, constant: 0) + let centerXConstraint = NSLayoutConstraint(item: aSettings, attribute: NSLayoutConstraint.Attribute.centerX, relatedBy: NSLayoutConstraint.Relation.equal, toItem: self.view, attribute: NSLayoutConstraint.Attribute.centerX, multiplier: 1, constant: 0) + let centerYConstraint = NSLayoutConstraint(item: aSettings, attribute: NSLayoutConstraint.Attribute.centerY, relatedBy: NSLayoutConstraint.Relation.equal, toItem: self.view, attribute: NSLayoutConstraint.Attribute.centerY, multiplier: 1, constant: 0) self.view.addConstraint(widthConstraint) self.view.addConstraint(heightConstraint) @@ -758,7 +769,7 @@ class KeyboardViewController: UIInputViewController { func stringIsWhitespace(_ string: String?) -> Bool { if string != nil { - for char in (string!).characters { + for char in (string!) { if !characterIsWhitespace(char) { return false } @@ -782,7 +793,7 @@ class KeyboardViewController: UIInputViewController { return false case .words: if let beforeContext = documentProxy.documentContextBeforeInput { - let previousCharacter = beforeContext[beforeContext.characters.index(before: beforeContext.endIndex)] + let previousCharacter = beforeContext[beforeContext.index(before: beforeContext.endIndex)] return self.characterIsWhitespace(previousCharacter) } else { @@ -791,7 +802,7 @@ class KeyboardViewController: UIInputViewController { case .sentences: if let beforeContext = documentProxy.documentContextBeforeInput { - let offset = min(3, beforeContext.characters.count) + let offset = min(3, beforeContext.count) var index = beforeContext.endIndex for i in 0 ..< offset { @@ -823,6 +834,8 @@ class KeyboardViewController: UIInputViewController { } case .allCharacters: return true + @unknown default: + return false } } else { @@ -831,7 +844,7 @@ class KeyboardViewController: UIInputViewController { } // this only works if full access is enabled - func playKeySound() { + @objc func playKeySound() { if !UserDefaults.standard.bool(forKey: kKeyboardClicks) { return } @@ -864,7 +877,7 @@ class KeyboardViewController: UIInputViewController { func createSettings() -> ExtraView? { // note that dark mode is not yet valid here, so we just put false for clarity let settingsView = DefaultSettings(globalColors: type(of: self).globalColors, darkMode: false, solidColorMode: self.solidColorMode()) - settingsView.backButton?.addTarget(self, action: #selector(KeyboardViewController.toggleSettings), for: UIControlEvents.touchUpInside) + settingsView.backButton?.addTarget(self, action: #selector(KeyboardViewController.toggleSettings), for: UIControl.Event.touchUpInside) return settingsView } } diff --git a/Keyboard/Media.xcassets/gear.imageset/Contents.json b/Keyboard/Media.xcassets/gear.imageset/Contents.json old mode 100644 new mode 100755 diff --git a/Keyboard/Media.xcassets/gear.imageset/gear.png b/Keyboard/Media.xcassets/gear.imageset/gear.png old mode 100644 new mode 100755 diff --git a/Keyboard/Media.xcassets/gear.imageset/gear@2x.png b/Keyboard/Media.xcassets/gear.imageset/gear@2x.png old mode 100644 new mode 100755 diff --git a/Keyboard/Media.xcassets/gear.imageset/gear@3x.png b/Keyboard/Media.xcassets/gear.imageset/gear@3x.png old mode 100644 new mode 100755 diff --git a/Keyboard/Shapes.swift b/Keyboard/Shapes.swift old mode 100644 new mode 100755 diff --git a/Keyboard/Utilities.swift b/Keyboard/Utilities.swift old mode 100644 new mode 100755 diff --git a/TastyImitationKeyboard.xcodeproj/project.pbxproj b/TastyImitationKeyboard.xcodeproj/project.pbxproj old mode 100644 new mode 100755 index e7c78cf3..52283956 --- a/TastyImitationKeyboard.xcodeproj/project.pbxproj +++ b/TastyImitationKeyboard.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 3FE808EF231F894300C1A90A /* GreekKeyboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FE808EE231F894300C1A90A /* GreekKeyboard.swift */; }; 4E00A6E5197183EE009414F2 /* KeyboardKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E807DC81946209600D875D1 /* KeyboardKey.swift */; }; 4E3B5A941A0654A8003366F6 /* KeyboardInputTraits.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E3B5A931A0654A8003366F6 /* KeyboardInputTraits.swift */; }; 4E52A6D21A06A61F006A08CE /* ImageKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E52A6D11A06A61F006A08CE /* ImageKey.swift */; }; @@ -95,6 +96,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 3FE808EE231F894300C1A90A /* GreekKeyboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GreekKeyboard.swift; sourceTree = ""; }; 4E3B5A931A0654A8003366F6 /* KeyboardInputTraits.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyboardInputTraits.swift; sourceTree = ""; }; 4E52A6D11A06A61F006A08CE /* ImageKey.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageKey.swift; sourceTree = ""; }; 4E52A6D31A06A626006A08CE /* ExtraView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExtraView.swift; sourceTree = ""; }; @@ -178,6 +180,7 @@ 4E5B67A1196E03B700114361 /* KeyboardModel.swift */, 4ECBD90119F16DC7004FA2A3 /* DefaultKeyboard.swift */, 4E60A13D1979FB2E00854CC8 /* DirectionEnum.swift */, + 3FE808EE231F894300C1A90A /* GreekKeyboard.swift */, ); name = Model; sourceTree = ""; @@ -388,16 +391,18 @@ attributes = { LastSwiftMigration = 0710; LastSwiftUpdateCheck = 0710; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 1030; ORGANIZATIONNAME = Apple; TargetAttributes = { 4E807D9219461D9000D875D1 = { CreatedOnToolsVersion = 6.0; - LastSwiftMigration = 0810; + DevelopmentTeam = EFHC4XFZ38; + LastSwiftMigration = 1030; }; 4E807DB819461DC700D875D1 = { CreatedOnToolsVersion = 6.0; - LastSwiftMigration = 0810; + DevelopmentTeam = EFHC4XFZ38; + LastSwiftMigration = 1030; }; 4E8EF38019F95D74009CBF5D = { CreatedOnToolsVersion = 6.1; @@ -407,7 +412,7 @@ }; buildConfigurationList = 4E807D8E19461D9000D875D1 /* Build configuration list for PBXProject "TastyImitationKeyboard" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -471,6 +476,7 @@ 4E52A6D21A06A61F006A08CE /* ImageKey.swift in Sources */, 4E52A6D41A06A626006A08CE /* ExtraView.swift in Sources */, 4EC2A47019DF811E00F789E1 /* ForwardingView.swift in Sources */, + 3FE808EF231F894300C1A90A /* GreekKeyboard.swift in Sources */, 4EC2A46E19DF811E00F789E1 /* KeyboardLayout.swift in Sources */, 4E60A13A1979FA5C00854CC8 /* KeyboardKeyBackground.swift in Sources */, 4E5B67A2196E03B700114361 /* KeyboardModel.swift in Sources */, @@ -537,6 +543,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -545,12 +552,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; @@ -589,6 +598,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -597,12 +607,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; @@ -637,11 +649,12 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + DEVELOPMENT_TEAM = EFHC4XFZ38; INFOPLIST_FILE = HostingApp/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "Archagon.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -651,11 +664,12 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + DEVELOPMENT_TEAM = EFHC4XFZ38; INFOPLIST_FILE = HostingApp/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "Archagon.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -663,12 +677,13 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; + DEVELOPMENT_TEAM = EFHC4XFZ38; INFOPLIST_FILE = Keyboard/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "Archagon.HostingApp.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = Keyboard; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -676,12 +691,13 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; + DEVELOPMENT_TEAM = EFHC4XFZ38; INFOPLIST_FILE = Keyboard/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "Archagon.HostingApp.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = Keyboard; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Release; }; From 7b6c79db340510db48dc36a4f319421ed793f6f4 Mon Sep 17 00:00:00 2001 From: badpirate Date: Wed, 11 Sep 2019 16:44:35 -0700 Subject: [PATCH 2/3] grexit (Remove uneeded greek file) --- TastyImitationKeyboard.xcodeproj/project.pbxproj | 4 ---- 1 file changed, 4 deletions(-) diff --git a/TastyImitationKeyboard.xcodeproj/project.pbxproj b/TastyImitationKeyboard.xcodeproj/project.pbxproj index 52283956..f18521d1 100755 --- a/TastyImitationKeyboard.xcodeproj/project.pbxproj +++ b/TastyImitationKeyboard.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 3FE808EF231F894300C1A90A /* GreekKeyboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FE808EE231F894300C1A90A /* GreekKeyboard.swift */; }; 4E00A6E5197183EE009414F2 /* KeyboardKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E807DC81946209600D875D1 /* KeyboardKey.swift */; }; 4E3B5A941A0654A8003366F6 /* KeyboardInputTraits.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E3B5A931A0654A8003366F6 /* KeyboardInputTraits.swift */; }; 4E52A6D21A06A61F006A08CE /* ImageKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E52A6D11A06A61F006A08CE /* ImageKey.swift */; }; @@ -96,7 +95,6 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 3FE808EE231F894300C1A90A /* GreekKeyboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GreekKeyboard.swift; sourceTree = ""; }; 4E3B5A931A0654A8003366F6 /* KeyboardInputTraits.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyboardInputTraits.swift; sourceTree = ""; }; 4E52A6D11A06A61F006A08CE /* ImageKey.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageKey.swift; sourceTree = ""; }; 4E52A6D31A06A626006A08CE /* ExtraView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExtraView.swift; sourceTree = ""; }; @@ -180,7 +178,6 @@ 4E5B67A1196E03B700114361 /* KeyboardModel.swift */, 4ECBD90119F16DC7004FA2A3 /* DefaultKeyboard.swift */, 4E60A13D1979FB2E00854CC8 /* DirectionEnum.swift */, - 3FE808EE231F894300C1A90A /* GreekKeyboard.swift */, ); name = Model; sourceTree = ""; @@ -476,7 +473,6 @@ 4E52A6D21A06A61F006A08CE /* ImageKey.swift in Sources */, 4E52A6D41A06A626006A08CE /* ExtraView.swift in Sources */, 4EC2A47019DF811E00F789E1 /* ForwardingView.swift in Sources */, - 3FE808EF231F894300C1A90A /* GreekKeyboard.swift in Sources */, 4EC2A46E19DF811E00F789E1 /* KeyboardLayout.swift in Sources */, 4E60A13A1979FA5C00854CC8 /* KeyboardKeyBackground.swift in Sources */, 4E5B67A2196E03B700114361 /* KeyboardModel.swift in Sources */, From 684ae014fe70041777189c5ef657ab3b6804ff8e Mon Sep 17 00:00:00 2001 From: badpirate Date: Wed, 11 Sep 2019 16:47:08 -0700 Subject: [PATCH 3/3] remove hard-coded invalid development team --- TastyImitationKeyboard.xcodeproj/project.pbxproj | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/TastyImitationKeyboard.xcodeproj/project.pbxproj b/TastyImitationKeyboard.xcodeproj/project.pbxproj index f18521d1..01975d25 100755 --- a/TastyImitationKeyboard.xcodeproj/project.pbxproj +++ b/TastyImitationKeyboard.xcodeproj/project.pbxproj @@ -393,12 +393,10 @@ TargetAttributes = { 4E807D9219461D9000D875D1 = { CreatedOnToolsVersion = 6.0; - DevelopmentTeam = EFHC4XFZ38; LastSwiftMigration = 1030; }; 4E807DB819461DC700D875D1 = { CreatedOnToolsVersion = 6.0; - DevelopmentTeam = EFHC4XFZ38; LastSwiftMigration = 1030; }; 4E8EF38019F95D74009CBF5D = { @@ -645,7 +643,7 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - DEVELOPMENT_TEAM = EFHC4XFZ38; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = HostingApp/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "Archagon.$(PRODUCT_NAME:rfc1034identifier)"; @@ -660,7 +658,7 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - DEVELOPMENT_TEAM = EFHC4XFZ38; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = HostingApp/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "Archagon.$(PRODUCT_NAME:rfc1034identifier)"; @@ -673,7 +671,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; - DEVELOPMENT_TEAM = EFHC4XFZ38; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Keyboard/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "Archagon.HostingApp.$(PRODUCT_NAME:rfc1034identifier)"; @@ -687,7 +685,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; - DEVELOPMENT_TEAM = EFHC4XFZ38; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Keyboard/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "Archagon.HostingApp.$(PRODUCT_NAME:rfc1034identifier)";