Keyboard Support

Contact and Search

Keyman.com Homepage

Header bottom

Keyman.com

Other versions
Version 16.0 (current version)Version 15.0Version 14.0Version 13.0 (home page)Version 12.0 (home page)Version 11.0 (home page)Version 10.0 (home page)Version 2.0 (home page)

On this page

KeymanPackage class

Summary

The KeymanPackage class and its subclasses represent Keyman package files and their contents.

Syntax

KeymanPackage.methodName()

Description

The KeymanPackage is the base class used to represent various types of Keyman packages within the Keyman Engine and their contents. As an abstract class, it serves as a "type erasure" for its subclasses KeyboardKeymanPackage and LexicalModelKeymanPackage, both of which offer richer typing for certain fields and methods.

Fields

key: KeymanPackage.Key
Returns a unique identifier for the package, usable in package-search operations.
languages: [Language]
An array of languages supported by the keyboards or lexical models contained by the package.

The most relevant fields for Language type are the name: String and id: String fields. (The other fields are mostly 'legacy'.)
name: String
The user-friendly name of the package.
resourceType: LanguageResourceType
An enum representing the type of LanguageResource contained within the package.

May be either .keyboard (for a KeyboardKeymanPackage) or .lexicalModel (for a LexicalModelKeymanPackage).
sourceFolder: URL
The base folder for the package's extracted contents.

Note: for packages opened with ResourceFileManager.shared.prepareKMPInstall, this may be a temporary location!

Stability is not guaranteed if you write to any contents of the folder or its subfolders, but read operations are permitted.
version: Version
The package's version.

Methods

installableResourceSets -> [[AnyLanguageResource]]
Returns a list of all resources & language pairings supported by this package.
installableResources(forLanguage: String) -> [AnyLanguageResource]
A language-filtered version of the method above.
pageURL(for: KeymanPackagePage) -> URL?
Provides a link to known .html files contained by the package.

Supported pages: .readme, .welcome, .custom(bundledPath: String), the latter of which may target arbitrary locations within the package.

History

Added in Keyman Engine for iPhone and iPad 14.0.

See Also

PackageWebViewController
Used to display web pages contained within a package.
KeyboardKeymanPackage
Represents packages containing keyboards.
LexicalModelKeymanPackage
Represents packages containing lexical models.