All Projects → RxSwiftCommunity → Rxkeyboard

RxSwiftCommunity / Rxkeyboard

Licence: mit
Reactive Keyboard in iOS

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Rxkeyboard

Jetchat
 Swift5.0编写的简仿微信聊天应用,完美支持表情键盘、单聊、群聊、本地消息会话缓存。
Stars: ✭ 61 (-95.1%)
Mutual labels:  rxswift, keyboard
Tswechat
A WeChat alternative. Written in Swift 5.
Stars: ✭ 3,674 (+194.86%)
Mutual labels:  rxswift, keyboard
Qwerty Lafayette
QWERTY keyboard layout for French-speaking users
Stars: ✭ 60 (-95.18%)
Mutual labels:  keyboard
Mouse2joystick custom cemu
An AutoHotkey Script to allow the use of Mouse and Keyboard control in CEMU. This uses vJoy and provides several additional features over regular keyboard control, like: the ability to control the camera with the mouse, toggle walking speed, in BotW use MouseWheel to change weapons, a separate Toggle key for ZL useful for locking onto a target in BotW.
Stars: ✭ 76 (-93.9%)
Mutual labels:  keyboard
Simpleapiclient Ios
A configurable api client based on Alamofire4 and RxSwift4 for iOS
Stars: ✭ 68 (-94.54%)
Mutual labels:  rxswift
On Screen Keyboard
A jQuery plug-in which provides users with a fluid-width on-screen keyboard.
Stars: ✭ 63 (-94.94%)
Mutual labels:  keyboard
Vimperator Labs
Vimperator
Stars: ✭ 1,184 (-4.98%)
Mutual labels:  keyboard
Teensy Thumb Keyboard
Handheld tactile switch keyboard for Teensy 3.2 compatible boards.
Stars: ✭ 61 (-95.1%)
Mutual labels:  keyboard
Rxbluetoothkit
iOS & OSX Bluetooth library for RxSwift
Stars: ✭ 1,213 (-2.65%)
Mutual labels:  rxswift
Keymousego
类似按键精灵的鼠标键盘录制和自动化操作 模拟点击和键入 | automate mouse clicks and keyboard input
Stars: ✭ 1,145 (-8.11%)
Mutual labels:  keyboard
Cleverbot
iOS Messaging Application using Cleverbot and ReactorKit
Stars: ✭ 74 (-94.06%)
Mutual labels:  rxswift
React Pong
✅ A pong game React component
Stars: ✭ 66 (-94.7%)
Mutual labels:  keyboard
Kuikeyboard
Keyboard Handler in iOS
Stars: ✭ 64 (-94.86%)
Mutual labels:  keyboard
Rxtodo
iOS Todo Application using RxSwift and ReactorKit
Stars: ✭ 1,186 (-4.82%)
Mutual labels:  rxswift
Loginwithrxswift
A demo with Sign up and Login function With RxSwift
Stars: ✭ 63 (-94.94%)
Mutual labels:  rxswift
Keynode
Interactive Keyboard Controller for Swift
Stars: ✭ 76 (-93.9%)
Mutual labels:  keyboard
Fx Experience
fx-experience -> fx onscreen keyboard
Stars: ✭ 72 (-94.22%)
Mutual labels:  keyboard
Rxexamples
Tests with RxSwift by book of Ray Wenderlich
Stars: ✭ 66 (-94.7%)
Mutual labels:  rxswift
Arisu Case
Case design files for Arisu Keyboard
Stars: ✭ 83 (-93.34%)
Mutual labels:  keyboard
Lipika Ime
Input Method Engine (IME) for Mac OS X with built-in support for all Indic Languages
Stars: ✭ 76 (-93.9%)
Mutual labels:  keyboard

RxKeyboard

Swift CocoaPods Build Status Carthage compatible

RxKeyboard provides a reactive way of observing keyboard frame changes. Forget about keyboard notifications. It also perfectly works with UIScrollViewKeyboardDismissMode.interactive.

rxkeyboard-message rxkeyboard-textview

Getting Started

RxKeyboard provides two Drivers.

/// An observable keyboard frame.
let frame: Driver<CGRect>

/// An observable visible height of keyboard. Emits keyboard height if the keyboard is visible
/// or `0` if the keyboard is not visible.
let visibleHeight: Driver<CGFloat>

/// Same with `visibleHeight` but only emits values when keyboard is about to show. This is
/// useful when adjusting scroll view content offset.
let willShowVisibleHeight: Driver<CGFloat>

Use RxKeyboard.instance to get singleton instance.

RxKeyboard.instance

Subscribe RxKeyboard.instance.frame to observe keyboard frame changes.

RxKeyboard.instance.frame
  .drive(onNext: { frame in
    print(frame)
  })
  .disposed(by: disposeBag)

Tips and Tricks

  • 🔗 I want to adjust UIScrollView's contentInset to fit keyboard height.

    RxKeyboard.instance.visibleHeight
      .drive(onNext: { [scrollView] keyboardVisibleHeight in
        scrollView.contentInset.bottom = keyboardVisibleHeight
      })
      .disposed(by: disposeBag)
    
  • 🔗 I want to adjust UIScrollView's contentOffset to fit keyboard height.

    RxKeyboard.instance.willShowVisibleHeight
      .drive(onNext: { [scrollView] keyboardVisibleHeight in
        scrollView.contentOffset.y += keyboardVisibleHeight
      })
      .disposed(by: disposeBag)
    
  • 🔗 I want to make UIToolbar move along with the keyboard in an interactive dismiss mode. (Just like the wonderful GIF above!)

    If you're not using Auto Layout:

    RxKeyboard.instance.visibleHeight
      .drive(onNext: { [toolbar, view] keyboardVisibleHeight in
        toolbar.frame.origin.y = view.frame.height - toolbar.frame.height - keyboardVisibleHeight
      })
      .disposed(by: disposeBag)
    

    If you're using Auto Layout, you have to capture the toolbar's bottom constraint and set constant to keyboard visible height.

    RxKeyboard.instance.visibleHeight
      .drive(onNext: { [toolbarBottomConstraint] keyboardVisibleHeight in
        toolbarBottomConstraint.constant = -1 * keyboardVisibleHeight
      })
      .disposed(by: disposeBag)
    

    Note: In real world, you should use setNeedsLayout() and layoutIfNeeded() with animation block. See the example project for example.

  • Anything else? Please open an issue or make a Pull Request.

Dependencies

Requirements

  • Swift 4
  • iOS 8+

Contributing

In development, RxKeyboard manages dependencies with Swift Package Manager. Use the command below in order to generate a Xcode project file. Note that .xcodeproj file changes are not tracked via git.

$ swift package generate-xcodeproj

Installation

  • Using CocoaPods:

    pod 'RxKeyboard'
    
  • Using Carthage:

    binary "https://raw.githubusercontent.com/RxSwiftCommunity/RxKeyboard/master/RxKeyboard.json"
    

    ⚠️ With Carthage, RxKeyboard only supports binary installation:

    • 0.9.2
      • Xcode 10.1 (10B61)
      • Swift 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1)
    • 0.9.0
      • Xcode 10 (10A255)
      • Swift 4.2 (swiftlang-1000.11.37.1 clang-1000.11.45.1)
    • 0.8.2
      • Xcode 9.3 (9E145)
      • Swift 4.1.0 (swiftlang-902.0.48 clang-902.0.37.1)
    • 0.7.1
      • Xcode 9.1 (9B55)
      • Swift 4.0.2 (swiftlang-900.0.69.2 clang-900.0.38)
    • 0.7.0
      • 9.0.1 (9A1004)
      • Swift 4.0 (swiftlang-900.0.65.2 clang-900.0.37)

License

RxKeyboard is under 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].