All Projects → kaweerutk → Commonkeyboard

kaweerutk / Commonkeyboard

Licence: mit
An elegant Keyboard library for iOS. simple, lightweight and standalone no sub-dependencies required

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Commonkeyboard

Sodieremojikeyboardplus
支持自定义emoji表情,icon font , FontAwesome,斜体,超链接,粗体,下划线,字体,颜色,镂空字体等富文本
Stars: ✭ 14 (-70.21%)
Mutual labels:  keyboard
Cmd Toutiao
摸鱼神器:在命令行中看今日头条
Stars: ✭ 34 (-27.66%)
Mutual labels:  keyboard
Inputsystem
An efficient and versatile input system for Unity.
Stars: ✭ 1,013 (+2055.32%)
Mutual labels:  keyboard
Armory Keyboard
utility for emulating a USB HID keyboard with the USBArmory
Stars: ✭ 28 (-40.43%)
Mutual labels:  keyboard
Typing Assistant
Typing Assistant provides the ability to autocomplete words and suggests predictions for the next word. This makes typing faster, more intelligent and reduces effort.
Stars: ✭ 32 (-31.91%)
Mutual labels:  keyboard
Jquery Keyfilter
This plugin filters keyboard input by specified regular expression.
Stars: ✭ 37 (-21.28%)
Mutual labels:  keyboard
All Around Keyboard
a web component for piano keyboards
Stars: ✭ 11 (-76.6%)
Mutual labels:  keyboard
Skr
Low level key re-programming
Stars: ✭ 47 (+0%)
Mutual labels:  keyboard
Emojikeyboard
自定义表情键盘(支持系统表情, 图片表情),仅供参考学习~
Stars: ✭ 33 (-29.79%)
Mutual labels:  keyboard
Typist
Swift UIKit keyboard manager for iOS apps.
Stars: ✭ 1,011 (+2051.06%)
Mutual labels:  keyboard
Voyager65 Keyplus
65% keyboard PCB for Keyplus firmware. Simplified variants available.
Stars: ✭ 29 (-38.3%)
Mutual labels:  keyboard
Mechanical Keyboard
DIY mechanical keyboard and where to find them
Stars: ✭ 947 (+1914.89%)
Mutual labels:  keyboard
React Spreadsheet Grid
An Excel-like grid component for React with custom cell editors, performant scroll & resizable columns
Stars: ✭ 996 (+2019.15%)
Mutual labels:  keyboard
Keystroke dynamics
a keystroke dynamics algorithm in python (recognizes a person by the way s/he types)
Stars: ✭ 21 (-55.32%)
Mutual labels:  keyboard
Tertiary text
[Pebble] Tertiary text input for the Pebble!
Stars: ✭ 43 (-8.51%)
Mutual labels:  keyboard
Myoddweb.piger
Piger is a Keystroke Launcher allowing you to run your own commands from your keyboard. Highlight a word hold the caps lock key and simply type 'Google' to search for it in your browser. You can create your own commands, in C#, Powershell, (+3), Python, LUA, C++ and more.
Stars: ✭ 13 (-72.34%)
Mutual labels:  keyboard
Chrome Virtual Keyboard
Touch-friendly Virtual Keyboard for Chrome browser
Stars: ✭ 35 (-25.53%)
Mutual labels:  keyboard
Gingham pcb
A 60% throughole keyboard inspired by the Plaid
Stars: ✭ 45 (-4.26%)
Mutual labels:  keyboard
Pxt Bluetooth Keyboard
BLE HID Keyboard module for micro:bit
Stars: ✭ 44 (-6.38%)
Mutual labels:  keyboard
Kfreestyle2d
Unofficial Kinesis Freestyle 2 Userspace Linux Driver
Stars: ✭ 41 (-12.77%)
Mutual labels:  keyboard

CommonKeyboard

An elegant Keyboard library for iOS. simple, lightweight and standalone no sub-dependencies required

Swift Swift

CommonKeyboard CommonKeyboardObserver

Installation

CocoaPods

Add the following to your Podfile

pod 'CommonKeyboard'

Carthage

Add the following to your Cartfile

github "kaweerutk/CommonKeyboard"

Usage

In AppDelegate.swift, just import CommonKeyboard framework and enable CommonKeyboard.

import CommonKeyboard

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

        // Just enable a single line of code
        CommonKeyboard.shared.enabled = true

        return true
    }
}

CommonKeyboard will automatically scroll to the input view when the cursor focused and tapping on a space to dismiss keyboard. This working with UIScrollView and all inheritance classes including UITableView and UICollectionView (Note: This does not support UITableViewController because it will handle by itself)

Adjust an offset between keyboard and input view by set keyboardOffset the default value is 10, Or ignore common keyboard by giving ignoredCommonKeyboard a true value.

 textField.keyboardOffset = 20
 textField.ignoredCommonKeyboard = true

 textView.keyboardOffset = 2
 textView.ignoredCommonKeyboard = false

CommonKeyboardObserver

You can subscribe CommonKeyboardObserver to get keyboard notification info.

import CommonKeyboard

class ExampleChatViewController: UIViewController {

    @IBOutlet var tableView: UITableView!
    @IBOutlet var bottomConstraint: NSLayoutConstraint!
    let keyboardObserver = CommonKeyboardObserver()

    override func viewDidLoad() {
        super.viewDidLoad()
        // drag down to dismiss keyboard
        tableView.keyboardDismissMode = .interactive

        keyboardObserver.subscribe(events: [.willChangeFrame, .dragDown]) { [weak self] (info) in
            guard let weakSelf = self else { return }
            var bottom = 0
            if info.isShowing {
                bottom = -info.visibleHeight
                if #available(iOS 11, *) {
                    bottom += weakSelf.view.safeAreaInsets.bottom
                }
            }
            UIView.animate(info, animations: { [weak self] in
                self?.bottomConstraint.constant = bottom
                self?.view.layoutIfNeeded()
            })
        }
    }

}

All events

public enum CommonKeyboardObserverEvent {
    case willShow
    case didShow
    case willHide
    case didHide
    case willChangeFrame
    case didChangeFrame
    case dragDown // scroll.keyboardDismissMode = .interactive
}

Sometimes there are many UIScrollView containers in UI Stack View and the CommonKeyboard cannot find the right one you can implement CommonKeyboardContainerProtocol and return specific container

extension ExampleChatViewController: CommonKeyboardContainerProtocol {
    var scrollViewContainer: UIScrollView {
        return tableView
    }
}

Others

 // dismiss keyboard
 CommonKeyboard.shared.dismiss()

 // get current UIResponder
 let responder = CommonKeyboard.shared.currentResponder

Requirements

  • iOS9 or later
  • Swift 4.2 or later

Contact

If you have any question or issue please create an issue!

License

CommonKeyboard is released under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].