Skip to content

Commit 70c1c55

Browse files
committed
Apply fix to all iOS versions
1 parent 17add6f commit 70c1c55

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

KeyboardLayoutGuide/KeyboardLayoutGuide/Keyboard+LayoutGuide.swift

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,11 @@ open class KeyboardLayoutGuide: UILayoutGuide {
5656
guard let view = owningView else {
5757
return
5858
}
59-
60-
if #available(iOS 11.0, *) {
61-
NSLayoutConstraint.activate([
62-
heightAnchor.constraint(equalToConstant: Keyboard.shared.currentHeight),
63-
leftAnchor.constraint(equalTo: view.leftAnchor),
64-
rightAnchor.constraint(equalTo: view.rightAnchor),
65-
])
66-
} else {
67-
NSLayoutConstraint.activate([
68-
heightAnchor.constraint(equalToConstant: 0),
69-
leftAnchor.constraint(equalTo: view.leftAnchor),
70-
rightAnchor.constraint(equalTo: view.rightAnchor),
71-
])
72-
}
73-
59+
NSLayoutConstraint.activate([
60+
heightAnchor.constraint(equalToConstant: Keyboard.shared.currentHeight),
61+
leftAnchor.constraint(equalTo: view.leftAnchor),
62+
rightAnchor.constraint(equalTo: view.rightAnchor),
63+
])
7464
let viewBottomAnchor: NSLayoutYAxisAnchor
7565
if #available(iOS 11.0, *) {
7666
viewBottomAnchor = view.safeAreaLayoutGuide.bottomAnchor
@@ -88,9 +78,7 @@ open class KeyboardLayoutGuide: UILayoutGuide {
8878
}
8979
heightConstraint?.constant = height
9080
animate(note)
91-
if #available(iOS 11.0, *) {
92-
Keyboard.shared.currentHeight = height
93-
}
81+
Keyboard.shared.currentHeight = height
9482
}
9583
}
9684

0 commit comments

Comments
 (0)