Keyboard Support

Contact and Search

Keyman.com Homepage

Header bottom

Keyman.com

On this page

Keyman for iPhone and iPad Developer Support

Overview

The Keyman Engine for iPhone and iPad 12.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.

Guides

Available Classes/Methods

Everything you need should be in these classes. It is especially important to look at Manager.swift

Manager
The core class for controlling Keyman Engine
TextField
A UITextField to use with the Keyman Engine
TextView
A UITextView to use with the Keyman Engine
KeyboardPickerButton
A button for bringing up the keyboard picker menu
KeyboardPickerBarButtonItem
A bar that displays the keyboard picker when tapped

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 12.0 version of Keyman Engine for iPhone and iPad was compiled using Swift 4.
    • 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":
    • DeviceKit
    • ObjcExceptionBridging
    • Reachability
    • XCGLogger
    • Zip
  • 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 .js files which you want to use to your project (e.g. thai_kedmanee.js)

  • 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
    Manager.shared.setKeyboard("thai_kedmanee");
    
  • the keyboard defaults to English USA if not set otherwise

Keyman Demo

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.

Additionally, you can see examples of:

  • TextView
  • TextField
  • KeyboardPickerButton
  • KeyboardPickerBarButtonItem
  • language fetching
  • keyboard downloading/switching
  • responding to Keyman events

See also