diff --git a/CustomKeyboard.xcodeproj/project.pbxproj b/CustomKeyboard.xcodeproj/project.pbxproj index 5bd0c02..1e290ff 100644 --- a/CustomKeyboard.xcodeproj/project.pbxproj +++ b/CustomKeyboard.xcodeproj/project.pbxproj @@ -256,6 +256,8 @@ A870F7C61940D2B400534539 /* Project object */ = { isa = PBXProject; attributes = { + LastSwiftMigration = 0710; + LastSwiftUpdateCheck = 0710; LastUpgradeCheck = 0600; ORGANIZATIONNAME = "Brian Donohue"; TargetAttributes = { diff --git a/CustomKeyboard.xcodeproj/project.xcworkspace/xcuserdata/RSC.xcuserdatad/UserInterfaceState.xcuserstate b/CustomKeyboard.xcodeproj/project.xcworkspace/xcuserdata/RSC.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..07ae029 Binary files /dev/null and b/CustomKeyboard.xcodeproj/project.xcworkspace/xcuserdata/RSC.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/CustomKeyboard/AppDelegate.swift b/CustomKeyboard/AppDelegate.swift index f3fcfdb..c8507a9 100644 --- a/CustomKeyboard/AppDelegate.swift +++ b/CustomKeyboard/AppDelegate.swift @@ -11,8 +11,9 @@ import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - - func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { + + func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { + self.window = UIWindow(frame: UIScreen.mainScreen().bounds) self.window!.rootViewController = CustomKeyboardViewController() self.window!.backgroundColor = UIColor.whiteColor() diff --git a/Keyboard/KeyButton.swift b/Keyboard/KeyButton.swift index 6c258c5..fc36123 100644 --- a/Keyboard/KeyButton.swift +++ b/Keyboard/KeyButton.swift @@ -27,7 +27,7 @@ class KeyButton: UIButton { self.contentHorizontalAlignment = .Center } - required init(coder aDecoder: NSCoder) { + required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } } \ No newline at end of file diff --git a/Keyboard/KeyboardViewController.swift b/Keyboard/KeyboardViewController.swift index d5af3b5..3510725 100644 --- a/Keyboard/KeyboardViewController.swift +++ b/Keyboard/KeyboardViewController.swift @@ -49,7 +49,7 @@ class KeyboardViewController: UIInputViewController { border.backgroundColor = UIColor(red: 210.0/255, green: 205.0/255, blue: 193.0/255, alpha: 1) self.view.addSubview(border) - var thirdRowTopPadding: CGFloat = topPadding + (keyHeight + rowSpacing) * 2 + let thirdRowTopPadding: CGFloat = topPadding + (keyHeight + rowSpacing) * 2 shiftKey = KeyButton(frame: CGRect(x: 2.0, y: thirdRowTopPadding, width:shiftWidth, height:shiftHeight)) shiftKey!.addTarget(self, action: Selector("shiftKeyPressed:"), forControlEvents: .TouchUpInside) shiftKey!.selected = true @@ -63,7 +63,7 @@ class KeyboardViewController: UIInputViewController { deleteKey!.setImage(UIImage(named: "delete-selected.png"), forState:.Highlighted) self.view.addSubview(deleteKey!) - var bottomRowTopPadding = topPadding + keyHeight * 3 + rowSpacing * 2 + 10 + let bottomRowTopPadding = topPadding + keyHeight * 3 + rowSpacing * 2 + 10 spaceKey = KeyButton(frame: CGRect(x:(320.0 - spaceWidth) / 2, y: bottomRowTopPadding, width:spaceWidth, height:spaceHeight)) spaceKey!.setTitle(" ", forState: .Normal) spaceKey!.addTarget(self, action: Selector("keyPressed:"), forControlEvents: .TouchUpInside) @@ -82,7 +82,7 @@ class KeyboardViewController: UIInputViewController { self.view.addSubview(returnButton!) var y: CGFloat = topPadding - var width = UIScreen.mainScreen().applicationFrame.size.width + let width = UIScreen.mainScreen().applicationFrame.size.width for row in rows { var x: CGFloat = ceil((width - (CGFloat(row.count) - 1) * (keySpacing + keyWidth) - keyWidth) / 2.0) for label in row { @@ -102,7 +102,7 @@ class KeyboardViewController: UIInputViewController { } func returnKeyPressed(sender: UIButton) { - var proxy = self.textDocumentProxy as UITextDocumentProxy + let proxy = self.textDocumentProxy as UITextDocumentProxy proxy.insertText("\n") numCharacters++ shiftPosArr[shiftPosArr.count - 1]++ @@ -116,7 +116,7 @@ class KeyboardViewController: UIInputViewController { func deleteKeyPressed(sender: UIButton) { if numCharacters > 0 { - var proxy = self.textDocumentProxy as UITextDocumentProxy + let proxy = self.textDocumentProxy as UITextDocumentProxy proxy.deleteBackward() numCharacters-- var charactersSinceShift = shiftPosArr[shiftPosArr.count - 1] @@ -149,7 +149,7 @@ class KeyboardViewController: UIInputViewController { } func keyPressed(sender: UIButton) { - var proxy = self.textDocumentProxy as UITextDocumentProxy + let proxy = self.textDocumentProxy as UITextDocumentProxy if spacePressed && sender.titleLabel?.text == " " { proxy.deleteBackward() proxy.insertText(". ") @@ -197,15 +197,15 @@ class KeyboardViewController: UIInputViewController { } } - override func textWillChange(textInput: UITextInput) { + override func textWillChange(textInput: UITextInput?) { // The app is about to change the document's contents. Perform any preparation here. } - override func textDidChange(textInput: UITextInput) { + override func textDidChange(textInput: UITextInput?) { // The app has just changed the document's contents, the document context has been updated. var textColor: UIColor - var proxy = self.textDocumentProxy as UITextDocumentProxy + let proxy = self.textDocumentProxy as UITextDocumentProxy if proxy.keyboardAppearance == UIKeyboardAppearance.Dark { textColor = UIColor.whiteColor() } else {