@@ -92,13 +92,12 @@ class MessageListViewController: UIViewController {
92
92
RxKeyboard . instance. visibleHeight
93
93
. drive ( onNext: { [ weak self] keyboardVisibleHeight in
94
94
guard let `self` = self , self . didSetupViewConstraints else { return }
95
- var actualKeyboardHeight = keyboardVisibleHeight
96
- if #available( iOS 11 . 0 , * ) , keyboardVisibleHeight > 0 {
97
- actualKeyboardHeight = actualKeyboardHeight - self . view. safeAreaInsets. bottom
98
- }
99
-
100
95
self . messageInputBar. snp. updateConstraints { make in
101
- make. bottom. equalTo ( self . bottomLayoutGuide. snp. top) . offset ( - actualKeyboardHeight)
96
+ if #available( iOS 11 . 0 , * ) {
97
+ make. bottom. equalTo ( self . view. safeAreaLayoutGuide. snp. bottom) . offset ( - keyboardVisibleHeight)
98
+ } else {
99
+ make. bottom. equalTo ( self . bottomLayoutGuide. snp. top) . offset ( - keyboardVisibleHeight)
100
+ }
102
101
}
103
102
self . view. setNeedsLayout ( )
104
103
UIView . animate ( withDuration: 0 ) {
@@ -140,7 +139,11 @@ class MessageListViewController: UIViewController {
140
139
}
141
140
self . messageInputBar. snp. makeConstraints { make in
142
141
make. left. right. equalTo ( 0 )
143
- make. bottom. equalTo ( self . bottomLayoutGuide. snp. top)
142
+ if #available( iOS 11 . 0 , * ) {
143
+ make. bottom. equalTo ( self . view. safeAreaLayoutGuide. snp. bottom)
144
+ } else {
145
+ make. bottom. equalTo ( self . bottomLayoutGuide. snp. top)
146
+ }
144
147
}
145
148
}
146
149
0 commit comments