Skip to content
This repository has been archived by the owner on Nov 19, 2023. It is now read-only.
/ KeyboardAvoiding Public archive

Easy to use keyboard avoiding library.

License

Notifications You must be signed in to change notification settings

CoreKit/KeyboardAvoiding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KeyboardAvoiding

Easy to use keyboard avoiding library.

Installation

Swift Package Manager

.package(url: "https://github.com/CoreKit/KeyboardAvoiding", from: "1.0.0"),

Usage

import UIKit
import KeyboardAvoiding

class ViewController: UIViewController {

    private var keyboardAvoiding: KeyboardAvoiding!

    override func viewDidLoad() {
        super.viewDidLoad()

        self.keyboardAvoiding = KeyboardAvoiding()
        .onKeyboardWillShow { rect in
            // do your stuff here 
        }
        .onKeyboardDidShow { rect in
            // do your stuff here
        }
        .onKeyboardWillHide {
            // do your stuff here
        }
        .onKeyboardDidHide {
            // do your stuff here
        }
    }

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)

        self.keyboardAvoiding.start()
    }

    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)

        self.keyboardAvoiding.stop()
    }
}