Interactive Keyboard Controller for Swift

Overview

Keynode

Carthage compatible Version License Platform

Why

Using UIScrollViewKeyboardDismissMode added in iOS7, interactive keyboard operation became possible. But, it only works on UIScrollView.

Keynode is able to interactive operate all inputView that appear as FirstResponder.

Appetize's Demo

UITextField UITextField UIPickerView
UIPickerView UITextField UITextField

Requirements

  • Swift 4.2
  • iOS 9.0 or later

How to Install

CocoaPods

Add the following to your Podfile:

pod "Keynode"

Carthage

Add the following to your Cartfile:

github "KyoheiG3/Keynode"

Usage

Function

func willAnimate(_ handler: @escaping (Bool, CGRect) -> Swift.Void) -> Keynode.Keynode
  • To be called just before the animation.
func animations(_ handler: @escaping (Bool, CGRect) -> Swift.Void) -> Keynode.Keynode
  • To be called when the display switching animation.
  • It is also called at the time of the keyboard operation of the scroll gesture.
func onCompleted(_ handler: @escaping (Bool, UIResponder?, UIView?) -> Swift.Void) -> Keynode.Keynode
  • To be called at the end animation.
func setResponder(responder: UIResponder)
  • Can set the responder.

Variable

var isGesturePanningEnabled: Bool
  • Set false if needn't pan the Keyboard with scrolling gesture.
  • Default is true.
var needsToChangeInsetAutomatically: Bool
  • Set false if needn't change content inset of UIScrollView when opened the Keyboard.
  • Default is true.
var defaultInsetBottom: CGFloat
  • Change bottom of contentInset if needed.
  • Default is 0
var gestureOffset: CGFloat
  • Such as when there is a toolbar, you can specify the offset of when closing the keyboard with scroll gesture.
  • If the value is not set, the value specified in the defaultInsetBottom will be used.

Extension

extension NSNotification.Name {
    static let UIResponderBecomeFirstResponder: Notification.Name
}
  • Notification name for become first responder.
extension UIApplication {
    func needsNotificationFromFirstResponder(_ from: Swift.AnyObject?)
}
  • Receive the notification from first responder when the function executed.

Caution

  • It might not work if the specification has been changed. however it will be solved in the earliest possible stage.
  • iOS9.0 ~ iOS12.0 is confirmed operation.

Acknowledgements

Author

Kyohei Ito

Follow me 🎉

LICENSE

Under the MIT license. See LICENSE file for details.

You might also like...
QMK Agent is a macOS menubar application which sends commands to a QMK enabled keyboard
QMK Agent is a macOS menubar application which sends commands to a QMK enabled keyboard

QMKagent QMK Agent is a macOS menubar application which sends commands to a QMK enabled keyboard Features System volume indicator using top row (Esc t

Showing / dismissing keyboard animation in simple UIViewController category.
Showing / dismissing keyboard animation in simple UIViewController category.

RSKKeyboardAnimationObserver Easy way to handle iOS keyboard showing/dismissing. Introduction Working with iOS keyboard demands a lot of duplicated co

Objective-C library for tracking keyboard in iOS apps.
Objective-C library for tracking keyboard in iOS apps.

NgKeyboardTracker Objective-c library for tracking keyboard in iOS apps. Adding to your project If you are using CocoaPods, add to your Podfile: pod '

A simple keyboard to use with numbers and, optionally, a decimal point.
A simple keyboard to use with numbers and, optionally, a decimal point.

MMNumberKeyboard A simple keyboard to use with numbers and, optionally, a decimal point. Installation From CocoaPods CocoaPods is a dependency manager

For less complicated keyboard event handling.

KeyboardObserver For less complicated keyboard event handling. Features Less complicated keyboard event handling. Do not use Notification , but event

A drop-in universal solution for moving text fields out of the way of the keyboard in iOS

TPKeyboardAvoiding A drop-in universal solution for moving text fields out of the way of the keyboard in iOS. Introduction There are a hundred and one

KeyboardMan helps you to make keyboard animation.

KeyboardMan We may need keyboard infomation from keyboard notifications to do animation. However, the approach is complicated and easy to make mistake

Emoji Keyboard SDK (iOS)
Emoji Keyboard SDK (iOS)

Makemoji SDK Makemoji is a free emoji keyboard for mobile apps. By installing our keyboard SDK every user of your app will instantly have access to ne

A Chinese keyboard for iOS that helps Chinese language learners remember tones.
A Chinese keyboard for iOS that helps Chinese language learners remember tones.

ToneBoard ToneBoard is a Chinese keyboard for iOS that requires you to enter the correct tones while typing simplified Chinese with Pinyin. It is avai

Comments
  • function keynode.completionHandler

    function keynode.completionHandler

    In the example project for keynode there is no example of how to use the keynode.completionHandler function. Could you update the project or show what the format would be to use the function(what to pass in as parameters)

    opened by wonathanjong 0
  • Correct the spelling of CocoaPods in README

    Correct the spelling of CocoaPods in README

    This pull requests corrects the spelling of CocoaPods 🤓 https://github.com/CocoaPods/shared_resources/tree/master/media

    Created with cocoapods-readme.

    opened by ReadmeCritic 0
  • First responder rejected resignFirstResponder when being removed from hierarchy

    First responder rejected resignFirstResponder when being removed from hierarchy

    This involves the inputAccessoryView as the firstResponder (imagine a UITextField right above the inputView). When the keyboard is dismissed the first time with a swipe (i.e. when willChangeLocationAnimation calls firstResponder?.origin?.resignFirstResponder(), this occurs:

    First responder warning: '<Loop.TypeField: 0x104113400; baseClass = UITextField; frame = (0 0; 414 68); text = ''; opaque = NO; gestureRecognizers = <NSArray: 0x10a7e0650>; layer = <CALayer: 0x103bd8b20>>' rejected resignFirstResponder when being removed from hierarchy

    Any ideas?

    opened by thesauravmitra 1
Owner
Kyohei Ito
Kyohei Ito
Best way to dismiss Keyboard in a View Controller iOS (Swift)

Best way to dismiss Keyboard in a View Controller iOS (Swift) First way: Implement UITextFieldDelegate’s textFieldShouldReturn method and dismiss curr

null 0 Dec 18, 2021
Codeless manager to hide keyboard by tapping on views for iOS written in Swift

KeyboardHideManager KeyboardHideManager - codeless manager to hide keyboard by tapping on views for iOS written in Swift. Structure Features Requireme

Bondar Yaroslav 55 Oct 19, 2022
Swift UIKit keyboard manager for iOS apps.

Typist Typist is a small, drop-in Swift UIKit keyboard manager for iOS apps. It helps you manage keyboard's screen presence and behavior without notif

Toto Tvalavadze 1.1k Dec 10, 2022
KeyboardKit is a Swift library that helps you create custom keyboard extensions for iOS and ipadOS.

KeyboardKit is a Swift library that helps you create custom keyboard extensions for iOS and ipadOS.

KeyboardKit 900 Jan 9, 2023
Slidden is an open source, customizable, iOS 8 keyboard, written in Swift

Slidden is an open source, customizable, iOS 8 keyboard, written in Swift. iOS 8 brought us the ability to create fully customizable keyboards, but do

Daniel Brim 595 Jan 5, 2023
Prevent keyboard from covering UITextField/UITextView, includes Swift and Objective-C APIs

Prevent keyboard from covering UITextField/UITextView with only one line of code, includes Swift and Objective-C APIs.

LiuChang 8 Oct 24, 2022
IHKeyboardAvoiding is an elegant solution for keeping any UIView visible when the keyboard is being shown - no UIScrollView required!

IHKeyboardAvoiding An elegant solution for keeping any UIView visible when the keyboard is being shown Requirements IHKeyboardAvoiding Version Objecti

Idle Hands Apps 1.4k Dec 14, 2022
Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. Neither need to write any code nor any setup required and much more.

IQKeyboardManager While developing iOS apps, we often run into issues where the iPhone keyboard slides up and covers the UITextField/UITextView. IQKey

Mohd Iftekhar Qurashi 15.9k Jan 8, 2023
⌨️ Add user-customizable global keyboard shortcuts to your macOS app in minutes

This package lets you add support for user-customizable global keyboard shortcuts to your macOS app in minutes. It's fully sandbox and Mac App Store c

Sindre Sorhus 1.1k Dec 29, 2022
Suppress mouse & keyboard events on MacOSX. Baby-proof my Mac!

Suppress mouse & keyboard events on MacOSX Catches all events (mouse, keyboard, everything), and either consumes them (locked state) or passes them th

Albert Zeyer 6 Oct 21, 2022