Keyman for iPhone and iPad Developer Support
The Keyman Engine for iPhone and iPad 14.0 SDK is designed to provide advanced international keyboard support to iOS apps.
As a developer, you simply need to use (or subclass) TextView or TextField instead of using an ordinary UITextView or UITextField.
To let a user pick/download additional keyboards, there are 2 pre-made buttons you can use that bring up the Keyman keyboard UI.
All of the methods and delegate calls of the original UIKit classes are retained.
With version 14.0, we have deprecated direct use of .js files for resources in favor of supporting .kmp packages. Package files have the same old .js files bundled alongside any related resources (like fonts and documentation) on your behalf, making the process of setting up keyboards and lexical models easier.
- The LanguageResourceFullID protocol and its implementing types
LexicalModelFullIDserve as unique identifiers for language resources, whether installed or uninstalled.
- The LanguageResource protocol and its implementing types
InstallableLexicalModelrepresent the full metadata specification for a single installed pairing of keyboard or model & target language.
- The KeymanPackage is the base class used to represent various types of Keyman packages within the Keyman Engine and their contents. This class also serves a "type erasure" role for classes derived from it.
- The TypedKeymanPackage (and its direct subclasses
LexicalModelKeymanPackage) provide enhanced type signatures.
- The core class for managing and installing keyboards and lexical models
Controlling the Keyboard
- The core class for controlling Keyman Engine
UI elements & setup
- A UITextField to use with the Keyman Engine
- A UITextView to use with the Keyman Engine
- A button for bringing up the keyboard picker menu
- A bar that displays the keyboard picker when tapped
- Displays web pages contained within packages, ejecting any links outside the package into an external browser.
Adding the Keyman Engine for iPhone and iPad SDK to your project
1) Create a new iOS project
2) On your project's "General" tab, click the '+' sign under "Embedded Binaries" to add KeymanEngine.framework.
- If you wish to use KeymanEngine-universal.framework instead for development, be aware
that you may need to note the following:
- Xcode may have issues with the "-universal" part of the name; dropping this component after copying may be prudent.
- The 14.0 version of Keyman Engine for iPhone and iPad was compiled using Swift 5.
- Dragging the framework into the project will not properly set the framework up for embedding.
- When done properly, Xcode should automatically link the library and setup the bundle for copying.
- To verify, go to your target's "Build Phases" tab and check that the following details are in place:
- 'KeymanEngine.framework' is set within "Link Binary With Libraries"
- 'KeymanEngine.framework' is set within "Embed Frameworks"
3) Include KeymanEngine's dependencies within your project:
(found in 'Link Binary With Libraries' in your target's 'build phases' tab)
- Ensure each of the following frameworks is included under "Embedded Binaries":
- You may find it helpful to use a dependency manager (such as Carthage) to assist with framework maintenance. You may find our Cartfile (used with Carthage) for this here.
4) Import "KeymanEngine" into any source files requiring Keyman classes.
5) [OPTIONAL] Add the language .kmp files which you want to use to your project (e.g. thai_kedmanee.kmp)
- drag them into the project
- go to your target, then the "Build Phases" tab, and add them to the "Copy Bundle Resources" section
- to avoid xcode warnings, remove them from the "Compile Sources" section
6) [OPTIONAL] Set the initial language prior to showing the keyboard for the first time
- it is recommended to do this when the app first launches
- e.g. for Thai Kedmanee
- the keyboard defaults to English USA if not set otherwise
To see the SDK in action, open the samples folder to find two small sample projects. All of the above steps have already been performed.