I´m testing the keyboard extension with new language swift on iOS, but I can´t play a sound for keyPressed event, and there is a delay, about 10 seconds when I click the key.
This is my code:
@IBAction func keyPressed(button: UIButton) {
var string = button.titleLabel!.text
(textDocumentProxy as UIKeyInput).insertText("\(string!)")
AudioServicesDisposeSystemSoundID(1104)
AudioServicesPlaySystemSound(1104)
UIView.animateWithDuration(0.2, animations: {
button.transform = CGAffineTransformScale(CGAffineTransformIdentity, 2.0, 2.0)
}, completion: {(_) -> Void in
button.transform =
CGAffineTransformScale(CGAffineTransformIdentity, 1, 1)
})
}
Thanks in advance for any comment or suggestion...