             var kbRect = (info[UIResponder.keyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
             kbRect = view.convert(kbRect, from: view.window)
             let height = view.bounds.size.height - kbRect.origin.y
-            if let constraint = keyboardHeight {
+            if let constraint = keyboardHeight() {
                 if constraint.constant != height {
                     print("Bottom layout constant = \(height)")
                     keyboardHeightDidUpdate(height)

import UIKit

public protocol KeyboardResponder {
    var keyboardHeight: NSLayoutConstraint? { get }
    func keyboardWillChange(_ notif: Notification)
    func keyboardHeightDidUpdate(_ height: CGFloat)
}


extension KeyboardResponder where Self: UIViewController {

    func keyboardHeight() -> NSLayoutConstraint? {
        return nil
    }

