IOS – Using custom hardware keyboard layout on iOS

ioskeybindingskeyboard

I have an iPad Pro with the Apple Smart Keyboard, which works well. I usually use it with the Colemak hardware keyboard layout, which comes built in to iOS.

I know that it is possible to install apps which give you custom virtual keyboards. Is it possible to do a similar thing but for hardware keyboard layouts?

In my case, I have a custom layout that I use on my computer to type the special characters in the International Phonetic Alphabet, and it would be nice to be able to use it on my iPad too.

(Please note that I am not asking how to install third-party virtual keyboards; I specifially want to install a hardware keyboard layout.)

Best Answer

Creating a hardware keyboard layout for iOS require you to assemble a .uchr file for the layout. This format is documented in the Unicode Utilities reference for the Carbon API. Such files could at one time be created with the klcompiler tool in the Font Tool Suite (!), except that it created big-endian output (probably from the PowerPC time) and iOS required little-endian output (more typical of the ARM processor), and this tool has since been retired from the Apple Download Centre, since it was 32-bits only (and there are only 64-bit versions of macOS remaining).

To install such a layout, it should be put in the /System/Library/KeyboardLayouts directory, which is not writable by the mobile user, but only by root. In addition, it is undocumented how new layouts are registered with the system - iOS does not scan this directory for new files as macOS does. A hack around this was to overwrite one of the existing layouts, e.g. USBKeyboardLayouts.bundle/uchrs/Colemak.uchr, and then select this one to activate it, but this would of course violate the checksum integrity of that layout.