keymanapp / keyman

Keyman cross platform input methods system running on Android, iOS, Linux, macOS, Windows and mobile and desktop web
https://keyman.com/
Other
398 stars 112 forks source link

[iOS] Integrate the system keyboard menu when appropriate #2384

Open jahorton opened 4 years ago

jahorton commented 4 years ago

As of iOS 10, there's a new API function of interest: https://developer.apple.com/documentation/uikit/uiinputviewcontroller/1649584-handleinputmodelist

While its base design is oriented for use as a selector for use by UI elements, we should be able to instead create special calls to this function that would allow the popup keyboard menu to provide an option to directly access the system keyboard menu instead. We'll probably need a bit of design work on how the integration should work, but this can provide much better control when swapping between system keyboards and Keyman.

Use of this feature is probably only appropriate for devices older than the iPhone X, which has its own, separate globe key outside of the keyboard. (Look for the needsInputModeSwitchKey property, which signals when iOS itself is providing this extra, keyboard-external version to users.) For devices with this set to true, the current menu is likely sufficient.

On investigation, this will likely require, at minimum, a partial rework on the KeyboardMenuView class - the design of handleInputModeList practically requires assigning the function via selector as a callback for a UIButton's touch events. (Synthetically generating a UIEvent requires undocumented API and will likely lead to App Store rejection. The parameter can't be left nil.)

jahorton commented 4 years ago

It's been noted that because of the highly limited access that iOS gives us to this function, integrating this into our keyboard menu would be more trouble than it's worth - there's a high potential for confusion and non-intuitive behavior for users.

Perhaps there may be a way forward, but it'll likely require a lot of thought and may possibly include a need for keyboard-menu redesign.