Skip to content

Commit fdad96f

Browse files
committed
Fix example project bottom margin
1 parent 0bf9f54 commit fdad96f

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

Example/RxKeyboardExample.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@
340340
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
341341
GCC_WARN_UNUSED_FUNCTION = YES;
342342
GCC_WARN_UNUSED_VARIABLE = YES;
343-
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
343+
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
344344
MTL_ENABLE_DEBUG_INFO = YES;
345345
ONLY_ACTIVE_ARCH = YES;
346346
SDKROOT = iphoneos;
@@ -392,7 +392,7 @@
392392
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
393393
GCC_WARN_UNUSED_FUNCTION = YES;
394394
GCC_WARN_UNUSED_VARIABLE = YES;
395-
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
395+
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
396396
MTL_ENABLE_DEBUG_INFO = NO;
397397
SDKROOT = iphoneos;
398398
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";

Example/Sources/ViewControllers/MessageListViewController.swift

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,12 @@ class MessageListViewController: UIViewController {
9292
RxKeyboard.instance.visibleHeight
9393
.drive(onNext: { [weak self] keyboardVisibleHeight in
9494
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-
10095
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+
}
102101
}
103102
self.view.setNeedsLayout()
104103
UIView.animate(withDuration: 0) {
@@ -140,7 +139,11 @@ class MessageListViewController: UIViewController {
140139
}
141140
self.messageInputBar.snp.makeConstraints { make in
142141
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+
}
144147
}
145148
}
146149

0 commit comments

Comments
 (0)