To start working with Fleksy Core SDK, we first need to sync the required dependency, set required flags, and finally obtain an instance of the FleksyLib class.
To use Fleksy Core SDK in your app, add the package as a dependency using its repository URL, as follows:
+
button, enter the repository URL, and click the Add Package button.Repository URL:
https://github.com/FleksySDK/FleksyCoreSDK-iOS
The FleksyLib class is the primary way to interact with the Fleksy Core SDK. You need to create an instance of FleksyLib
to start using the autocorrection, next word prediction, and swipe functionalities.
To create a FleksyLib instance, you need to pass it a valid language file (.jet
extension) and a LibraryConfiguration object.
For example:
let languageFile = URL(fileURLWithPath: "resourceArchive-en-US.jet")
let libraryConfiguration = LibraryConfiguration(
license: LicenseConfiguration(
licenseKey: "<your-license-key>",
licenseSecret: "<your-license-secret>"
)
)
Now obtain an instance of FleksyLib:
let fleksyLib = try! FleksyLib(languageFileURL: languageFile, configuration: libraryConfiguration)
Now you can start using the methods from the FleksyLib instance.
There are 3 main methods offered by FleksyLib namely:
There are also additional methods available that can be explored in the class as per requirements.
The currentWordPrediction and nextWordPrediction methods can be used within any application that wishes to take benefit of autocorrection and next word predictions. Both method requires an instance of TypingContext as a parameter.
In case you are integrating the Fleksy Core SDK in your custom keyboard application, you can use additional methods offered by the FleksyLib instance. The swipePrediction and currentWordPrediction (overload method) methods requires an instance of TypingContext and a list of LayoutPoint.
An instance of LayoutPoint contains information regarding the position of the key (within the keyboard) where the user has tapped. The Fleksy Engine uses that to offer better predictions. It is important to note that a valid LayoutType must be provided as a parameter to LibraryConfiguration when instantiating FleksyLib before any methods utilizing LayoutPoint can be used.
The Fleksy Core SDK supports many languages other than the default starting language. A complete list of supported languages can be found in the Languages section. To work with different languages, the SDK offers various methods in the LanguagesHelper class, among which the two main methods are:
There are also additional methods available that can be explored in the class as per requirements.