Custom iOS Keyboard Extension
? ALLORA ?
Conversational filler, in italian: ‘Well, then..’
? Description ?
This repo provides the starting point for a custom iOS keyboard extension for Xcode, which provides a series of buttons for sending different combinations of input text and clipboard content to an LLM via REST API.
This is currently configured to send a request to a locally hosted LLM using oobabooga’s text-generation-webui (https://github.com/oobabooga/text-generation-webui). It could easily be altered to work with any other LLM of your choice.
The API is expected to process the user input and return a response, which will be displayed in the input field. See below for examples of how to provide input from the iOS Keyboard.
This was originally built to serve the purpose of providing summarizations, quick replies, or in-text/chat LLM responses that can be generated anywhere on iOS where the native keyboard is displayed. It can be used to generate replies to messages, emails, to write a tweet, or transform text in just about any way you see fit.
⭐ Features ⭐
- Custom keyboard layout with four buttons:
- Send Both
- Send Text
- Clipboard…
- Text…
- Extracts the input field text and clipboard content.
- Sends extracted text to a REST API for processing.
- Displays the API response in the input field.
? Installation ?
-
Clone this repository:
git clone https://github.com/nicksavarese/allora-ios.git
-
Open the project in Xcode.
-
Change the API URL in the
sendAPIRequest
function to match your API endpoint. -
Update the Development Team and Bundle Identifier for each target to match your Apple Developer account details:
You will need to replace “API_URL” and “API_PORT” with your API URL and PORT details to the KeyboardViewController.swift file on line 130.
Before building, be sure to add your Apple Developer details so you can sign the app properly.
- Build and run the project on a simulator or a connected device.
⚡ Usage ⚡
- Open any app that supports text input.
- Long press the globe icon on the default keyboard and select the custom keyboard (AlLoRa) from the list. Note: you may need to provide “Full Access” to the keyboard by going to Settings>General>Keyboards>AlLoRa, and then be sure that Full Access is enabled.
- Use the buttons to send text to the API as seen in the examples below.
- The API response will be displayed in the input field, and replaces input field text.
? Examples ?
Send Both:
Sends the input field text along with the highlighted (clipboard) text.
For example, if the input field text is:
Write a nice and detailed reply with the solution
and the clipboard text is:
Can u pls help?? my Apple watch has two faces smiling and frowning at me on it and now it won’t ring anymore????
the API will receive both phrases and respond accordingly.
Send Text:
Sends the input field text only.
For example, if the input field text is
Write a quote by Marcus Aurelius
the API will receive this phrase alone.
Clipboard…:
Sends the highlighted (clipboard) text, asking the API to continue it.
For example, if the clipboard text is
Let me not to the marriage of true minds…
the API will receive this phrase with a request to continue it.
Text…:
Sends the input field text, asking the API to continue it.
For example, if the input field text is
Here is the plot of the show, ‘Westworld':
The API will receive this phrase with a request to continue it.
? Customization
To customize the keyboard layout or the API request, modify the KeyboardViewController
class in the Xcode project.
? Note
Remember to update the Development Team and Bundle Identifier for each target to match your Apple Developer account details. This ensures the project is signed properly for deployment.
? License
This project is licensed under the Apache License, Version 2.0. See the LICENSE file for more details.