I created a custom keyboard on xcode using Swift. It works perfectly on simulator but when I tested it on real device the response was very slow (min 5 sec) though keyboard appears quickly. I do not know what is the problem. When button is pressed it takes too much time to type the text or sometimes crashes. Any ideas?
func handleTapOnButton(button: UIButton) {
let buttonText = button.titleForState(.Normal)
if let proxy = textDocumentaryProxy {
if button.titleForState(.Normal) == " " {
proxy.insertText(" ")
} else {
proxy.insertText(buttonText!)
}
}
if globals.tapped != 3 && (switchedToNumbers == false) {
lowerCase()
globals.tapped = 1
}
}