@@ -51,7 +51,7 @@ extension UIView {
51
51
open class KeyboardLayoutGuide : UILayoutGuide {
52
52
public var usesSafeArea = true {
53
53
didSet {
54
- updateButtomAnchor ( )
54
+ updateBottomAnchor ( )
55
55
}
56
56
}
57
57
@@ -71,6 +71,12 @@ open class KeyboardLayoutGuide: UILayoutGuide {
71
71
name: UIResponder . keyboardWillChangeFrameNotification,
72
72
object: nil
73
73
)
74
+ notificationCenter. addObserver (
75
+ self ,
76
+ selector: #selector( keyboardWillChangeFrame ( _: ) ) ,
77
+ name: UIResponder . keyboardWillHideNotification,
78
+ object: nil
79
+ )
74
80
notificationCenter. addObserver (
75
81
self ,
76
82
selector: #selector( keyboardDidChangeFrame ( _: ) ) ,
@@ -88,10 +94,10 @@ open class KeyboardLayoutGuide: UILayoutGuide {
88
94
rightAnchor. constraint ( equalTo: view. rightAnchor) ,
89
95
]
90
96
)
91
- updateButtomAnchor ( )
97
+ updateBottomAnchor ( )
92
98
}
93
99
94
- func updateButtomAnchor ( ) {
100
+ func updateBottomAnchor ( ) {
95
101
if let bottomConstraint = bottomConstraint {
96
102
bottomConstraint. isActive = false
97
103
}
@@ -177,6 +183,10 @@ extension Notification {
177
183
return nil
178
184
}
179
185
186
+ if name == UIResponder . keyboardWillHideNotification {
187
+ return 0.0
188
+ }
189
+
180
190
let keyboardMinY = keyboardFrame. cgRectValue. minY
181
191
182
192
// Weirdly enough UIKeyboardFrameEndUserInfoKey doesn't have the same behaviour
0 commit comments