Git Product home page Git Product logo

keyboardkitpro's Introduction

KeyboardKit Logo

Version Swift 5.9 Swift UI MIT License Twitter: @@getkeyboardkit Mastodon: @keyboardkit@techhub.social

About KeyboardKit

KeyboardKit is a Swift SDK that lets you create fully customizable keyboards in a few lines of code, using SwiftUI.

KeyboardKit extends Apple's native APIs and provides you with a lot more functionality. It lets you mimic the native iOS keyboard and tweak its style and behavior, or create completely custom keyboards.

Custom iOS keyboard extensions can be used with all other apps that support text input. It's the only way for your product, brand or technology to directly interact with other apps on iOS. Don't miss out!

KeyboardKit can be used in different ways. Keyboard extensions can use it to create custom keyboards. Apps can use it to check keyboard and full access status, provide settings etc.

Installation

KeyboardKit can be installed with the Swift Package Manager:

https://github.com/KeyboardKit/KeyboardKit.git

After installing KeyboardKit, make sure to link it to all targets that need it.

Getting Started

After installing KeyboardKit, just make your KeyboardViewController inherit KeyboardInputViewController instead of UIInputViewController:

import KeyboardKit

class KeyboardController: KeyboardInputViewController {}

This gives your controller access to new lifecycle functions like viewWillSetupKeyboard, observable state like state.keyboardContext, services like services.actionHandler, and much more.

If you just want to use the default SystemKeyboard view, which mimics a native iOS keyboard, you don't have to do anything else. KeyboardKit will set up everything.

To replace or customize the default SystemKeyboard, just override viewWillSetupKeyboard and call setup with a view builder:

class KeyboardViewController: KeyboardInputViewControllerย {

    override func viewWillSetupKeyboard() {
        super.viewWillSetupKeyboard()
        setup { [weak self] controller in // <-- Use [weak self] or [unowned self] if you need self here.
            SystemKeyboard(
                state: controller.state,
                services: controller.services,
                buttonContent: { $0.view },
                buttonView: { $0.view },
                emojiKeyboard: { $0.view },
                toolbar: { _ in MyCustomToolbar() }
            )
        }
    }
}

For more information, please see the getting started guide.

Supported Locales

KeyboardKit supports 63 keyboard-specific locales:

๐Ÿ‡ฆ๐Ÿ‡ฑ ๐Ÿ‡ฆ๐Ÿ‡ช ๐Ÿ‡ฆ๐Ÿ‡ฒ ๐Ÿ‡ง๐Ÿ‡พ ๐Ÿ‡ง๐Ÿ‡ฌ ๐Ÿ‡ฆ๐Ÿ‡ฉ ๐Ÿณ๏ธ ๐Ÿ‡ญ๐Ÿ‡ท ๐Ÿ‡จ๐Ÿ‡ฟ ๐Ÿ‡ฉ๐Ÿ‡ฐ
๐Ÿ‡ณ๐Ÿ‡ฑ ๐Ÿ‡ง๐Ÿ‡ช ๐Ÿ‡บ๐Ÿ‡ธ ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ‡บ๐Ÿ‡ธ ๐Ÿ‡ช๐Ÿ‡ช ๐Ÿ‡ซ๐Ÿ‡ด ๐Ÿ‡ต๐Ÿ‡ญ ๐Ÿ‡ซ๐Ÿ‡ฎ ๐Ÿ‡ซ๐Ÿ‡ท
๐Ÿ‡ง๐Ÿ‡ช ๐Ÿ‡จ๐Ÿ‡ญ ๐Ÿ‡ฌ๐Ÿ‡ช ๐Ÿ‡ฉ๐Ÿ‡ช ๐Ÿ‡ฆ๐Ÿ‡น ๐Ÿ‡จ๐Ÿ‡ญ ๐Ÿ‡ฌ๐Ÿ‡ท ๐Ÿ‡บ๐Ÿ‡ธ ๐Ÿ‡ฎ๐Ÿ‡ฑ ๐Ÿ‡ญ๐Ÿ‡บ
๐Ÿ‡ฎ๐Ÿ‡ธ ๐Ÿณ๏ธ ๐Ÿ‡ฎ๐Ÿ‡ฉ ๐Ÿ‡ฎ๐Ÿ‡ช ๐Ÿ‡ฎ๐Ÿ‡น ๐Ÿ‡ฐ๐Ÿ‡ฟ ๐Ÿ‡น๐Ÿ‡ฏ ๐Ÿ‡น๐Ÿ‡ฏ ๐Ÿ‡น๐Ÿ‡ฏ ๐Ÿ‡ฑ๐Ÿ‡ป
๐Ÿ‡ฑ๐Ÿ‡น ๐Ÿ‡ฒ๐Ÿ‡ฐ ๐Ÿ‡ฒ๐Ÿ‡พ ๐Ÿ‡ฒ๐Ÿ‡น ๐Ÿ‡ฒ๐Ÿ‡ณ ๐Ÿ‡ณ๐Ÿ‡ด ๐Ÿณ๏ธ ๐Ÿ‡ฎ๐Ÿ‡ท ๐Ÿ‡ต๐Ÿ‡ฑ ๐Ÿ‡ต๐Ÿ‡น
๐Ÿ‡ง๐Ÿ‡ท ๐Ÿ‡ท๐Ÿ‡ด ๐Ÿ‡ท๐Ÿ‡บ ๐Ÿ‡ท๐Ÿ‡ธ ๐Ÿ‡ท๐Ÿ‡ธ ๐Ÿ‡ธ๐Ÿ‡ฐ ๐Ÿ‡ธ๐Ÿ‡ฎ ๐Ÿ‡ช๐Ÿ‡ธ ๐Ÿ‡ฐ๐Ÿ‡ช ๐Ÿ‡ธ๐Ÿ‡ช
๐Ÿ‡น๐Ÿ‡ท ๐Ÿ‡บ๐Ÿ‡ฆ ๐Ÿ‡บ๐Ÿ‡ฟ

KeyboardKit provides a basic keyboard layout with basic callout actions.ย KeyboardKit Pro provides localized layouts, callouts and behaviors for all supported locales.

Open-Source Features

KeyboardKit comes packed features to help you build amazing keyboard extensions:

  • โŒจ๏ธ Essentials - KeyboardKit provides essential utilities, types & views.
  • ๐Ÿ’ฅ Actions - KeyboardKit makes it easy to trigger keyboard-related actions.
  • ๐Ÿ’ก Autocomplete - KeyboardKit can perform autocomplete.
  • ๐Ÿ—ฏ Callouts - KeyboardKit can show input & secondary action callouts.
  • ๐ŸŒˆ Colors - KeyboardKit defines keyboard-specific colors.
  • ๐Ÿ–ฅ๏ธ Device - KeyboardKit has device-specific utilities.
  • ๐Ÿ˜€ Emojis - KeyboardKit defines emojis, categories, versions, skin tones, etc.
  • ๐Ÿ”‰ Feedback - KeyboardKit can trigger audio & haptic feedback.
  • ๐Ÿ‘† Gestures - KeyboardKit has a customizable keyboard gesture engine.
  • ๐Ÿ–ผ๏ธ Images - KeyboardKit defines keyboard-specific images.
  • ๐Ÿ”ฃ Layout - KeyboardKit has customizable input sets & keyboard layouts.
  • ๐ŸŒ Localization - KeyboardKit defines localized texts & assets for 63 locales.
  • ๐Ÿ—บ๏ธ Navigation - KeyboardKit lets you open urls and apps from the keyboard.
  • ๐Ÿ‘ Previews - KeyboardKit has extensive SwiftUI preview support.
  • โžก๏ธ Proxy - KeyboardKit extends UITextDocumentProxy with a lot more capabilities.
  • โš™๏ธ Settings - KeyboardKit has tools for in-app settings & System Settings.
  • ๐Ÿฉบ Status - KeyboardKit can detect if a keyboard is enabled, has full access, etc.
  • ๐ŸŽจ Styling - KeyboardKit lets you style your keyboards to great extent.

These features are all open-source and free to use. You can upgrade to KeyboardKit Pro to unlock Pro features.

KeyboardKit Pro

KeyboardKit Pro unlocks Pro features, like fully localized and locale-specific system keyboards, layouts & services, on-device and remote autocomplete & autocorrect, dictation, themes, etc.

  • โŒจ๏ธ Essentials - KeyboardKit Pro unlocks more essential tools, system keyboard previews, etc.
  • ๐Ÿ’ฅ Actions - KeyboardKit Pro auto-registers the most recently used emojis.
  • ๐Ÿค– AI - KeyboardKit Pro unlocks features that are needed for AI.
  • ๐Ÿ“ฑ App - KeyboardKit Pro unlocks app-specific screens & views.
  • ๐Ÿ’ก Autocomplete - KeyboardKit Pro unlocks on-device & remote autocomplete.
  • ๐Ÿ—ฏ Callouts - KeyboardKit Pro unlocks localized callouts for all locales.
  • ๐ŸŽค Dictation - KeyboardKit Pro can perform dictation from the keyboard.
  • ๐Ÿ˜€ Emojis - KeyboardKit Pro unlocks a powerful emoji keyboard.
  • โŒจ๏ธ External - KeyboardKit Pro can detect if an external keyboard is connected.
  • ๐Ÿ”‰ Feedback - KeyboardKit Pro unlocks tools for toogling feedback on & off.
  • ๐Ÿ”ฃ Layout - KeyboardKit Pro unlocks localized layouts for all locales.
  • ๐ŸŒ Localization - KeyboardKit Pro unlocks 63 locale-specific services and system keyboards.
  • ๐Ÿ‘ Previews - KeyboardKit Pro unlocks system keyboard and theme previews.
  • โžก๏ธ Proxy - KeyboardKit Pro unlocks ways for UIKit/UITextDocumentProxy to read the full document.
  • ๐Ÿ“ Text - KeyboardKit Pro unlocks tools to let you type within the keyboard.
  • ๐Ÿญ Themes - KeyboardKit Pro unlocks a theme engine with many pre-defined themes.

Every article in the documentation describes in detail what KeyboardKit Pro unlocks for that part of the SDK.

Documentation

The online documentation has more information, articles, code examples, etc.

Demo App

The demo app shows how to display keyboard state, link to system settings, etc.

The demo app has two demo keyboards:

  • Keyboard uses KeyboardKit and a customized SystemKeyboard.
  • KeyboardPro uses KeyboardKit Pro and enables all locales, autocomplete, themes, etc.

Just open and run the demo app in the Demo folder, then enable the keyboards under System Settings. Note that you need to enable full access for some features to work.

KeyboardKit App

If you want to try KeyboardKit Pro without having to write any code or build the demo app from Xcode, there is a KeyboardKit app in the App Store, that lets you try out many pro features.

Support This Project

KeyboardKit is open-source and completely free, but you can support the project by becoming a GitHub Sponsor, upgrading to KeyboardKit Pro or get in touch for freelance work, paid support etc.

Contact

Feel free to reach out if you have questions or if you want to contribute in any way:

License

KeyboardKit is available under the MIT license. See the LICENSE file for more info.

keyboardkitpro's People

Contributors

danielsaidi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

keyboardkitpro's Issues

fullDocumentContext emoji scan issue

Issue Description

When the text contains emojis, additional symbols are added in the text. This issue occurs when the text includes three consecutive emojis, and the scan result duplicates the first three letters of the word following the emojis.

Steps to Reproduce

  1. Open the text containing three consecutive emojis and a word following them, for example:
Combinations are simply a set of emojis arranged one after the other, for example: ๐Ÿ‘‘๐Ÿ’ฌ๐ŸŽค. You can use them to make riddles or communicate without words. Also, combinations can express emotions and moods, for example, ๐Ÿ‘€๐Ÿ‘€๐Ÿ‘€ can mean curiosity or surprise. Combinations have become popular in messages and social networks, where they give text more expressiveness
  1. Summarize or autocorrect the text.
  2. Observe the generated prompt.

Actual Result

After running the fullDocumentContext feature, the result includes additional symbols, such as "ComCombinations" and "AlsAlso," which duplicate the first three letters of the word following the emojis:

ComCombinations are simply a set of emojis arranged one after the other, for example: ๐Ÿ‘‘๐Ÿ’ฌ๐ŸŽค. You can use them to make riddles or communicate without words. AlsAlso, combinations can express emotions and moods, for example, ๐Ÿ‘€๐Ÿ‘€๐Ÿ‘€ can mean curiosity or surprise. Combinations have become popular in messages and social networks, where they give text more expressiveness

Environment

KeyboardKitPro 7.5.0

Hide emoji buttons on keyboard

Hello, the Emoji page we purchased in the Basic version is blank. How can I hide the Emoji button on the keyboard?

I referred to the code for inserting language switching in DemoLayoutProvider in the Demo and used the itemRows.remove(.emoji) method, but .emjoi also needs to enter a parameter, and I don't understand how to use it.

fullDocumentContext bug

The fullDocumentContext() function always copies the text at least twice.

Hereโ€™s a simple example of sending the fullDocumentContext result to the pasteboard and then manually pasting it elsewhere:

Code:
Button(action : { Task { let proxy = keyboardContext.textDocumentProxy let result = try? await proxy.fullDocumentContext() await MainActor.run { UIPasteboard.general.string = result?.fullDocumentContext } } }, label: { Image(systemName: "wand.and.stars").frame(width: 32, height: 32, alignment: .center) })

Video:
https://user-images.githubusercontent.com/39917898/210093317-94777503-a397-4112-b112-7277a697f79f.mp4

Keyboard casing issue `uppercased` acts like `capsLocked` in text proxies

I am trying to add additional text fields to a custom keyboard for things like a search bar but am running into an issue with casing. The search text field defaults to uppercased but it capitalizes all the letters like capsLocked instead of just the first. The ordinary double-tap capsLocked works fine and so does the lowerCased. This issue only persists in added text proxies so I believe that is where it lies. I've attached a video below.

Simulator.Screen.Recording.-.iPhone.7.Plus.-.2021-07-09.at.19.55.40.mp4

Looking in KeyboardCasing where the keyboard cases are defined I see the following comment:
".uppercased should conform to the text proxy's autocapitalization type."
I think the issue might be here, but I'm not sure how exactly to access the text proxy's autocapitalization type or how to set/override it. For reference, I am using the text proxy from: https://gist.github.com/wearhere/f46ab9d837acaeaabfa86a813c44ad25.

Feature Request: Ability to Disable Auto-correction While Keeping Auto-suggestions

Hello, I'm currently using KeyboardKitPro for a project and have come across a limitation that I'd like to discuss. I want to disable the auto-correction feature while keeping the auto-suggestions feature active.

Current Behavior:
When I set the isAutocorrectionEnabled flag to false, it deactivates not only auto-correction but also auto-suggestions.

Desired Behavior:
I'd like to have the ability to disable auto-correction independently of auto-suggestions. Specifically, when I tap the space bar after typing a word, I'd like the word not to be automatically corrected while still being able to see auto-suggestion options.

Use Case:
This feature would be beneficial for users who want to type freely without being auto-corrected, but who still find value in the auto-suggestions provided by the keyboard.

I understand this might require a significant change, and I appreciate your consideration of this feature request.

Thank you!

User-Specific Dictionary Support Guidance

I am trying to implement support user local dictionary support. I want to learn some words that user inputed or he reverted after autocorrection. My first approach was is inherit class LocalAutocompleteProvider. In this case the suggestion quality is dramatically makes worse. I also tried to use func learnWord(_ word: String) but it looks like doesn't affect it. Could you follow me up how to use pro version of autocomplete provider and enrich his logic? My last approach based on using custom KeyboardActionHandler but it is not fit all my intents.

I am in the process of incorporating a feature for user-specific dictionary support. The aim is to keep comprehend words inputted by the user, including those that were reverted following autocorrection. Initially, I attempted to use inheritance with the LocalAutocompleteProvider class. However, this approach resulted in a significant degradation in suggestion quality. Additionally, I attempted to utilize the function 'learnWord(_ word: String)', but it did not seem to have any discernible impact.

Could you possibly provide guidance on the use of the pro version of the autocomplete provider, particularly in terms of enhancing its logic? My most recent attempt involved using a custom KeyboardActionHandler, but this method did not fully accommodate my requirements. Any assistance you could provide would be greatly appreciated.

final class CustomAutocompleteProvider: LocalAutocompleteProvider {}

final class KeyboardViewController: KeyboardInputViewController {

    override func viewWillSetupKeyboard() {
        super.viewWillSetupKeyboard()

        do {
            try setupPro(
                withLicenseKey: "[Key]",
                view: { controller in KeyboardView(controller: controller) },
                licenseConfiguration: setupKeyboardWithLicense
            )
        } catch {
            os_log("license error \(error)")
        }
    }

    func setupKeyboardWithLicense(_ license: License) {
        autocompleteProvider = try! CustomAutocompleteProvider()
    }
}

fullDocumentContext table scan issue

Issue Description

When the cursor is outside a table, the text inside the table is not recognized. I created a table in notes:

|----------|----------|
| The report provides new estimates of the chances of crossing the global warming level of 1.5ยฐC in the next decades, and | |
| The report states that without immediate, rapid, and large-scale reductions in greenhouse gas emissions, it will be impossible to limit global warming to 1.5ยฐC or even 2ยฐC.finds that unlessr
The report says that without immediate and large reductions in greenhouse gas emissions, it will be impossible to limit global warming to 1.5ยฐC or even 2ยฐC. there are immediate, rapid and large-scale reductions in greenhouse gas emissions, limiting warming to close to 1.5ยฐC or even 2ยฐC will be beyond reach. | |

Steps to Reproduce

  1. Open the document containing a table with text inside it.
  2. Place the cursor outside the table.
  3. Try to call fullDocumentContext.

Actual Result

When trying to us, the API indicating that there is no text.

Expected Result

The system should recognize the text inside the table regardless of the cursor's position.

Environment

KeyboardKitPro 7.5.0

Unable to disable autocorrection

Hey!

I have been trying to disable autocorrection but without any luck although I've set autocorrectionDisabled(true) as seen below - unless I am doing it wrongly.

SystemKeyboard(
                    state: controller.state,
                    services: controller.services,
                    buttonContent: { $0.view },
                    buttonView: { $0.view },
                    emojiKeyboard: { _ in EmojiKeyboard(
                   state: state,
                    services: services)
                    },
                    toolbar: { _ in }
                   
                )
                .autocorrectionDisabled(true)

Appstore upload issue: ITMS-90683 issue: NSSpeechRecognitionUsageDescription

I was unable to upload to Appstore my application with new version of KeyboardKitPro.

The affected versions: 7.4.1 and 7.5.0
No affected versions: 7.1.3 and 7.2.2

You canโ€™t upload the application to Appstore/Testflight, I get a refusal with the following Appstore message:

We identified one or more issues with a recent delivery for your app, [App Name]. Please correct the following issues, then upload again.

ITMS-90683: Missing purpose string in Info.plist - Your app's code references one or more APIs that access sensitive user data, or the app has one or more entitlements that permit such access. The Info.plist file for the "[app name]" bundle should contain a NSSpeechRecognitionUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data. If you're using external libraries or SDKs, they may reference APIs that require a purpose string. While your app might not use these APIs, a purpose string is still required. For details, visit: https://developer.apple.com/documentation/uikit/protecting_the_user_s_privacy/requesting_access_to_protected_resources.

I am not using speech recognition in my app and not want to add to declare it.

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.