spiegel-keyman/ios/docs/engine/ResourceFileManager/install.md
2024-10-31 10:13:00 +07:00

1.8 KiB

title
.install()

Summary

The install() method is used to install resources from opened package files.

Syntax

ResourceFileManager.shared.install(resourceWithID: URL, from: KeymanPackage) throws

Parameters

resourceWithID
Either a FullKeyboardID or a FullLexicalModelID corresponding to the resource to be installed from the package.
from
The opened package file

Throws

May fail if the package does not contain or support the designated resource and language pairing specified by the resource's ID.

Description

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

Example: Using install() to install a keyboard

The following script illustrates the use of install():

let packageURL = Bundle.main.url(forResource: "sil_euro_latin", withExtension: "kmp")!
let keyboardID = FullKeyboardID("sil_euro_latin", "fr") // Marks the keyboard for use with French.
do {
  if let keyboardPackage = try ResourceFileManager.shared.prepareKMPInstall(packageURL) as? KeyboardKeymanPackage {
    try ResourceFileManager.shared.install(resourceWithID: keyboardID, from: keyboardPackage)
  } else {
    // Report the error
  }
} catch {
  // Report the error
}

History

  • Added in Keyman Engine for iPhone and iPad 14.0.

See also