MGKeyboardAccessory is a keyboard accessory to input special characters in UITextField or UI directly. It allows developers to add the custom button with characters in keyboard accessory, characters in the button will be inserted to text field if the button is clicked.
- Support custom characters.
- Support two styles: defualt and dark.
- Support UITextField, UITextView and their subclasses.
To run the example project, clone the repo, and run pod install
from the Example directory first.
MGKeyboardAccessory is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'MGKeyboardAccessory'
Build and import the module:
import MGKeyboardAccessory
It is very simple to add a keyboard accessoray for text field. In our demo, we added a black style accessoray:
blackTextField.setupKeyboardAccessory([":", "/", "\""], barStyle: .black)
The first parameter is a string array to create custom button, the second parameter is the bar style. Use UIBarStyle provided by UIKit directly.
MGKeyboardAccessory also supports reactive extension for RxSwift.
Observable.just([":", "/", "?", "&", ".", "="])
.bind(to: textView.rx.keyboardAccessoryStrings(style: .black)).disposed(by: disposeBag)
Meng Li, https://fczm.pw, lm2343635@126.com
MGKeyboardAccessory is available under the MIT license. See the LICENSE file for more info.