@@ -51,7 +51,7 @@ extension UIView {
5151open class KeyboardLayoutGuide : UILayoutGuide {
5252 public var usesSafeArea = true {
5353 didSet {
54- updateButtomAnchor ( )
54+ updateBottomAnchor ( )
5555 }
5656 }
5757
@@ -71,6 +71,12 @@ open class KeyboardLayoutGuide: UILayoutGuide {
7171 name: UIResponder . keyboardWillChangeFrameNotification,
7272 object: nil
7373 )
74+ notificationCenter. addObserver (
75+ self ,
76+ selector: #selector( keyboardWillChangeFrame ( _: ) ) ,
77+ name: UIResponder . keyboardWillHideNotification,
78+ object: nil
79+ )
7480 notificationCenter. addObserver (
7581 self ,
7682 selector: #selector( keyboardDidChangeFrame ( _: ) ) ,
@@ -88,10 +94,10 @@ open class KeyboardLayoutGuide: UILayoutGuide {
8894 rightAnchor. constraint ( equalTo: view. rightAnchor) ,
8995 ]
9096 )
91- updateButtomAnchor ( )
97+ updateBottomAnchor ( )
9298 }
9399
94- func updateButtomAnchor ( ) {
100+ func updateBottomAnchor ( ) {
95101 if let bottomConstraint = bottomConstraint {
96102 bottomConstraint. isActive = false
97103 }
@@ -177,6 +183,10 @@ extension Notification {
177183 return nil
178184 }
179185
186+ if name == UIResponder . keyboardWillHideNotification {
187+ return 0.0
188+ }
189+
180190 let keyboardMinY = keyboardFrame. cgRectValue. minY
181191
182192 // Weirdly enough UIKeyboardFrameEndUserInfoKey doesn't have the same behaviour
0 commit comments