         super.viewDidLoad()
         
         var xibViews = NSBundle.mainBundle().loadNibNamed("cat-keyboard", owner: self, options: nil)
-        self.mainView = xibViews[0] as UIView
+        self.mainView = xibViews[0] as! UIView
         self.view.addSubview(mainView)
         
-        for v in self.mainView.subviews as [UIButton] {
+        for v in self.mainView.subviews as! [UIButton] {
             v.addTarget(self, action: "btnPressed:", forControlEvents: .TouchUpInside)
         }
     }
     
     func btnPressed(sender: AnyObject) {
-        var btn = sender as UIButton
-        let proxy = self.textDocumentProxy as UIKeyInput
+        var btn = sender as! UIButton
+        let proxy = self.textDocumentProxy as! UIKeyInput
         
         switch (btn.tag) {
             case 1:

        // The app has just changed the document's contents, the document context has been updated.
    
        var textColor: UIColor
        var proxy = self.textDocumentProxy as UITextDocumentProxy
        if proxy.keyboardAppearance == UIKeyboardAppearance.Dark {
            textColor = UIColor.whiteColor()
        } else {

            case 5:
                // copy keyboard cat
                let imageStringURL = NSBundle.mainBundle().pathForResource("keyboardcat", ofType: "gif")
                var data = NSData(contentsOfURL: NSURL(fileURLWithPath: imageStringURL!)!);
                UIPasteboard.generalPasteboard().setData(data!, forPasteboardType: "com.compuserve.gif")
            default:
                return
        }
