Skip to content

A quick way to implement default features for Better Keyboard (by Solfanto).

License

Notifications You must be signed in to change notification settings

n-studio/BetterKeyboardSDK

Repository files navigation

BetterKeyboardSDK

A quick way to implement default features in UITextView for Better Keyboard (by Solfanto) (https://itunes.apple.com/app/better-keyboard-by-solfanto/id1049294250?ls=1&mt=8).

Better Keyboard is an iOS keyboard extension that simulates computer keyboards' shortcuts like ⌘+c. Unfortunately, the extension can't support the shortcuts by its own, the applications used with the keyboard must support the shortcuts as well.

If you own an iOS application, you can easily implement these shortcuts with this SDK. You can also read the source code and implement your own shortcuts.

If you own an iOS keyboard extension, we encourage you to also support shortcuts using the same API. (documentation coming soon)

Run Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

BetterKeyboardSDK is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "BetterKeyboardSDK", git: "[email protected]:n-studio/BetterKeyboardSDK.git"

Usage

Call these methods when implementing UITextViewDelegate or UITextFieldDelegate.

func textField(textField: UITextField, shouldChangeTextInRange range: NSRange, replacementString string: String) -> Bool {
    return textField.bk_advancedTextFieldShouldChangeTextInRange(range, replacementString: string)
}
func textView(textView: UITextView, shouldChangeTextInRange range: NSRange, replacementText text: String) -> Bool {
    return textView.bk_advancedTextViewShouldChangeTextInRange(range, replacementText: text)
}

func textViewDidChangeSelection(textView: UITextView) {
    textView.bk_advancedTextViewDidChangeSelection()
}

Shortcuts

⌘a: Select all
⌘c: Copy
⌘x: Cut
⌘v: Paste
⌘z: Undo
⌘y: Redo
⌘←: Select left
⌘→: Select right
⎋ or ␛: Escape (currently no effect)

Contribute

The API is still in draft, feel free to open issues to make feature suggestions or any comment/criticism.

If the keyboard extension Better Keyboard (by Solfanto) itself has a bug, feel free to report it here.

Author

Matthew Nguyen, Solfanto, Inc.

License

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

About

A quick way to implement default features for Better Keyboard (by Solfanto).

Resources

License

Stars

Watchers

Forks

Packages

No packages published