Skip to content
TAGKeyboard is the library to fix issue related keyboard while text field or text view is present.
Swift Shell Ruby Objective-C
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


CI Status Version License Platform


To run the example project, clone the repo, and run pod install from the Example directory first.


To integrate the TAGKeyboard in your project follow the steps :-

  1. "import TAGKeyboard".
  2. extend your view controller with TAGKeyboard.
    class ViewController: TAGKeyboard {}

3. Add the scroll view on your view and take the outlet to main viewcontroller. 4. Implement the viewDidLoad() and call the super.viewDidLoad() and also set the delegate instance for respective text view and text fields. 5. From your viewDidLoad set the scrollViewHolder = @your_scrollview ##### @IBOutlet var baseScrollView: UIScrollView!
    override func viewDidLoad() {
      // "Do call the super"
      scrollViewHolder = baseScrollView
      testTextView.delegate = self
      testTextfield.delegate = self
  1. Now implement the respective delegates for text view and text field. "Do call the super of that particular method."

######Example for text view delegates:-

override func textViewShouldBeginEditing(textView: UITextView) -> Bool {
    return (super.textViewShouldBeginEditing(textView))

override func textViewDidEndEditing(textView: UITextView) {

override func textViewDidBeginEditing(textView: UITextView) {

######Example for text field delegates:-

override func textFieldShouldReturn(textField: UITextField) -> Bool {
    return (super.textFieldShouldReturn(textField))

override func textFieldDidBeginEditing(textField: UITextField) {

override func textFieldDidEndEditing(textField: UITextField) {
  1. If you are using following method then need to call the super of particular one. This method are implemented in TAGKeyboard class.

     1.1  If you want this method in your view then implement it in your view controller and call the parent func bu super.<br />
     main function:-
     <br />
     override public func viewDidLayoutSubviews() {
             screenSize = UIScreen.mainScreen().bounds
     1.2 To disappear the keyboard on orientation change implemented this method in TAGKeyboard class. 
     (Can by pass this method)

override public func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) { dismissKeyboard() }

    1.3 dismissKeyboard() :- called only view.endEditing(). But need to implemented by user on particular view.     <br />
  1. Also user need to implement the tap gesture on their view controller separately.


TAGKeyboard is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'TAGKeyboard', '~>2.0.0'




TAGKeyboard is available under the MIT license. See the LICENSE file for more info.

You can’t perform that action at this time.