Getting started

How to install and use iOS SDK

Let’s set up your Sample keyboard, which takes just a few minutes. Follow the instructions below to add the keyboard SDK to an existing application.

To use the SDK, please note that you first need a license key which can be requested in the developer’s dashboard.
The below steps assume that you already have an existing project to add Fleksy SDK support. In case you lack an existing project, follow the steps given at official Apple documentation to create a new project.

Step 1

Xcode provides support to add a new Custom Keyboard Extension target to your project that can be used to quickly generate required files and schemes to build your custom keyboard.

  1. Navigate to File > New > Target,
  2. Select the Custom Keyboard Extension from the Application Extension group and click next,
  3. Specify the other target extension details asked by Xcode afterward and click finish.

Add new Custom Keyboard Extension target

Step 2

Add the FleksySDK package as a dependency using its repository URL https://github.com/FleksySDK/FleksySDK-iOS, as follows:

  1. Navigate to Project’s General Pane > Package Dependencies,
  2. Click on the + button and enter the repository URL and click Add Package button.

Add FleksySDK package dependency

Step 3

  1. Modify the KeyboardViewController class present in the keyboard target you created in step 1. This class should inherit from FKKeyboardViewController.
  2. Override the method createConfiguration to return a configuration as shown below.
  3. Finally replace <your-license-key> and <your-license-secret> with your license.
FleksySDK doesn’t support building with bitcode so it must be disabled in order to avoid compilation failures.
It is recommended NOT to commit your license keys in the code but to store them as variables in the environment and access them during the compilation.
import FleksyKeyboardSDK

class KeyboardViewController: FleksyKeyboardSDK.FKKeyboardViewController {

    override func createConfiguration() -> KeyboardConfiguration {
        let style = StyleConfiguration()

        let appPopup = AppearancePopup()
        let appLongpress = AppearanceLongPress()
        let appearance = AppearanceConfiguration(
            objPopup: appPopup,
            objTouch: nil,
            objLongpress: appLongpress
        )

        let typing = TypingConfiguration()
        let panelConfig = PanelConfiguration()
        let debugConfig = DebugConfiguration(debug: ())

        let licenseConfig = LicenseConfiguration(
            licenseKey: "<your-license-key>",
            licenseSecret: "<your-license-secret>"
        )

        return KeyboardConfiguration(
            panel: panelConfig,
            capture: nil,
            style: style,
            appearance: appearance,
            typing: typing,
            specialKeys: nil,
            license: licenseConfig,
            debug: debugConfig
        )
    }
}

Last updated on July 7, 2022