Saturday, December 6, 2014 [Tweets] [Favorites]

Developing Keyboards for iOS

Norbert Lindenberg on what he learned developing his English IPA Keyboard (App Store):

Yes, some of these suggestions sound a little desperate, and for many keyboards you will at some point have to request full access. Things would be a lot easier if Apple allowed containing apps to write into their keyboards’s containers, similar to how the Mail app delivers attachments into an app’s Inbox directory, without the need for full access. This would let containing apps send dictionaries and configuration settings to the keyboard while protecting user input from being leaked out of the keyboard.

[…]

A number of keyboards have been rejected based on section 25.6, so it seems something is required. For the first version of the English IPA keyboard, I argued that the keyboard was designed as a supplementary keyboard, not as a user’s primary keyboard, and therefore shouldn’t have to support all the keyboard types, similar to Apple’s emoji keyboard. My keyboard was approved, but at least one other developer using similar arguments saw his app rejected.

[…]

It’s much better to design custom images for the function keys that your keyboard needs. There doesn’t seem to be any way for third-party keyboards to access the images that Apple’s built-in keyboards use.

[…]

Reading the documentation might lead you to expect that your input view controller’s textDidChange method will be called when “text has changed in the document”, or selectionDidChange when “the selection has changed in the document”. Reality as of iOS 8.1 is that textDidChange and its buddy textWillChange are called when the keyboard’s client view becomes or resigns as first responder and when the selection changes, and selectionDidChange and its peer selectionWillChange are never called. Of course, this might get fixed eventually, so don’t rely on this either.

[…]

The documentation for UIKeyInput.deleteBackward states that it deletes “a character”. Those familiar with Unicode, NSString, and Swift’s String type know that the word “character” is quite overloaded – it could mean a Unicode code point, a UTF-16 code unit, or an extended grapheme cluster. But that’s only where the trouble starts.

[…]

Implementing forward deletion as described in the API Quick Start for Custom Keyboards section of the Guide also does not work. It depends on the assumption that the increment used by adjustTextPositionByCharacterOffset matches what deleteBackward deletes, but in reality that’s not always the case.

[…]

It seems unlikely that you could invade the user’s privacy by playing click sounds when she taps a key, but the method in charge of these sounds, UIDevice.playInputClick, hangs for several seconds rather than doing its job when called without full access.

Comments

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment