Keyboard Support

Contact and Search

Keyman.com Homepage

Header bottom

Keyman.com

Other versions
Version 13.0Version 12.0Version 11.0Version 10.0

On this page

Manager.parseKMP()

Summary

The parseKMP() method installs resources for languages via ad-hoc distribution found at the folder URL.

Syntax

Manager.parseKMP(folder: URL, type: LanguageResourceType = .keyboard)

Parameters

folder
URL to the KMP package.
type
The type of language resource stored in the package. May be one of the following: .keyboard, .lexicalModel

Description

This syntax can be used for installing resources from a KMP package.

Example 1: Using parseKMP() to install a keyboard

The following script illustrates the use of parseKMP():

let adhocKbdDir = _adhocDirectory {
  self.window?.rootViewController?.dismiss(animated: true, completion: {
  do {
    try Manager.shared.parseKMP(adhocKbdDir) // assumes .keyboard by default
      self.showSimpleAlert(title: "Success", message: "All keyboards installed successfully.")
    } catch {
      self.showKMPError(error as! KMPError)
  }
}

Example 2: Using parseKMP() to install a dictionary

The following script illustrates the use of parseKMP():

let adhocDictDir = _adhocDirectory {
  self.window?.rootViewController?.dismiss(animated: true, completion: {
  do {
    try Manager.shared.parseKMP(adhocKbdDir, type: .lexicalModel)
      self.showSimpleAlert(title: "Success", message: "Dictionary installed successfully.")
    } catch {
      self.showKMPError(error as! KMPError)
  }
}