Code Monkey home page Code Monkey logo

keynode's Introduction

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.

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.

keynode's People

Contributors

kyoheig3 avatar readmecritic avatar

Watchers

James Cloos avatar Alvin Cris Uy avatar  avatar

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.