Giter Club home page Giter Club logo

hostappforkeyboardextension's Introduction

KeyboardExtensionHostApp

Description

This app serves as a host environment for a custom iOS keyboard extension.

The keyboard can have several horizontally scrollable pages showing several rows of buttons with letters or icons on them. Additionally there is a navigation bar with the obligatory switch-keyboard-button, a delete-button and a left / right button to scroll to the previous / next page.

Runtime Requirements

iOS 10.2 or later

Customisable features

The buttons' content is loaded via a json-file, which must be part of the CustomKeyboard target. Its format looks like this:

[{
 "page1": {
    "row1": [".", ".", ".", ".", ".", ".", ".", "."],
    "row2": [".", ".", ".", ".", ".", ".", ".", "."],
    "row3": [".", ".", ".", ".", ".", ".", ".", "."],
 },
 "page2": {
    "row1": [".", ".", ".", ".", ".", ".", ".", "."],
    "row2": [".", ".", ".", ".", ".", ".", ".", "."],
    "row3": [".", ".", ".", ".", ".", ".", ".", "."],
 },
}]

Custom features can be adjusted in the KeyboardSettings class (in MyCustomFramework):

  • navigation bar height
  • maximum number of pages (must be bigger than 0)
  • maximum number of rows (must be bigger than 0)
  • background color of the navigation bar
  • background color of the scrollable keyboard part
  • text color of the navigation bar buttons
  • text color of the key buttons

Installation instructions

To add the keyboard to your project follow these steps:

  1. Add a new target โ€“ a custom keyboard extension - to your project and call it CustomKeyboard. Make sure to use that name, or the following step will have to be adapted.
  2. Open your project in the Finder and replace the CustomKeyboard folder with the one from the HostApp project; then copy and paste MyCustomFramework into the project folder as well.
  3. Drag and drop buttonTitles from the CustomKeyboard folder into the respecting folder in Xcode; then drag and drop MyCustomFramework.xcodeproj from the Finder into your project. If the little arrow next to the framework name does not immediately show up, open and close XCode.
  4. Add the framework to both targets, YourApp and CustomKeyboard.
  5. Finally build all of them in the following order: MyCustomFramework, CustomKeyboard, YourApp.
  6. Run your app and include the new keyboard in the device's settings.

More

All of MyCustomFramework's classes and structs have originally been part of CustomKeyboard, I however recently decided that I wanted to try and make the keyboard testable. Until now, it has not been possible to directly test keyboard extensions. Extracting the code into a separate framework circumvents this problem.

Having started the project under the assumption of not being able to test the code, it neither include tests (yet) nor has it been built with that goal in mind. Changing that will be the next step forward.

Screenshots

page1 page1

hostappforkeyboardextension's People

Contributors

fabias avatar

Stargazers

Lasha Efremidze avatar

Watchers

 avatar

hostappforkeyboardextension's Issues

Json parsing

Make sure all characters get parsed correctly.
When testing the following string did not make it:
"\o/"

Landscape constraints

When putting device into landscape mode (and/or back) the constraints do not update. This results in one line of buttons being hidden behind the navigation bar.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.