iosswiftuiviewios-keyboard-extension

Custom Keyboard on iOS


I need to create a custom keyboard for my app, but no sure the best way to do it without the user needing to add a keyboard in the settings. If I create a keyboard extension is it possible to set a UITextField's Keyboard Type to that custom keyboard? Or will I have to use a UIView to accomplish this?

enter image description here


Solution

  • For a custom keyboard that is specific to a single app, create a view and assign the view to UITextField.inputView:

    textField.inputView = YourCustomKeyboard()
    

    In my search I didn't find a way to tack on additional keys but there are examples of custom keyboards using inputView that are easy to adapt.

    A custom decimal keyboard example

    My hexadecimal keyboard version