iOS Keyboard Observer Protocol
import UIKit
class mainVC: UIViewController, Keyboardable {
override func viewDidLoad() {
super.viewDidLoad()
keyboardObserver { (height) in
//code
}
}
override func viewWillDisappear(_ animated: Bool) {
removeKeyboardObserver()
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
self.view.endEditing(true)
}
override var prefersStatusBarHidden: Bool {
return true
}
}//
Usage is provided under the MIT License. See LICENSE for the full details.