Algorithm Keyboard

Algorithm Keyboard

Sep 23, 2024

Creating and editing algorithms is an integral part of my app. So I needed to create an input method that would make it easy. Luckily there's a handy library for creating a custom in-app keyboard: https://github.com/paescebu/CustomKeyboardKit

After adding that as a package dependency, it was pretty easy to setup. The library gives you direct access to a UITextDocumentProxy. The proxy allows you to do things like read the text around the cursor, insert and delete. Basically everything you need to function similarly to any other keyboard.

The hard part was in making it look and feel like a keyboard. Unfortunately, the library doesn't come with some type of keyboard button style, so I had to create my own that closely matches the system (otherwise, they would all look like stock SwiftUI buttons). After days of fiddling, I finally settled on this layout.

image

Amount of taps to sledgehammer (R' F R F'):

Regular (15 taps): ^R(123)'␣^F␣^R␣^F(123)'

Custom (6 taps 🎉): R A' F R F A'

Подобається цей допис?

Купити для Cuber каву

Більше від Cuber