iOS detect keyboard layout (e.g. QWERTY, AZERTY)

Published

I am building a custom suggestion/autocorrection feature in an iOS app. It must detect accidental adjacent keypresses and compare this to a known word list to suggest the word it thinks the user intended to type.

For example, if the custom word list contains cat, dog, monkey, and the user types cst, the app can determine that the most likely word was cat (because s is adjacent to the a key)

QWERTY keyboard showing cst

This will work on a standard QWERTY keyboard, but what happens if the user is using an AZERTY keyboard?

enter image description here

For the autocorrect/suggest to work reliably, the app must be able to detect the keyboard layout in use.

In iOS, it is possible to obtain a UITextInputMode object from a UITextField. This object has a primaryLanguage (string) property, which will display the locale (e.g. en-GB), but this does not contain enough granularity to distinguish between English (Australia) QWERTY and English (Australia) AZERTY. In both cases, the primaryLanguage is en-AU.

Is it possible to detect the keyboard layout in iOS?

Source: Ios

Published
Categorised as autosuggest, internationalization, ios, keyboard, uitextfield

Answers

I have found this old question that may have a solution for you. No sure it’s still working, but it shows in the question how to get the current instaled keyboards, and someone provided a “gray area” solution, as it seems that there is no direct way to achieve what you intend to do.
Hope this help.


Prof. Amelia Dooley II

Leave a Reply

Your email address will not be published. Required fields are marked *

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq