Created
June 22, 2019 19:45
-
-
Save Arrlindii/84b558dd05244afee0621fc80f1eb6ef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let keyboardWillOpen = NotificationCenter.default | |
| .publisher(for: UIResponder.keyboardWillShowNotification) | |
| .map {$0.userInfo![UIResponder.keyboardFrameEndUserInfoKey] as! CGRect} | |
| .map {$0.height} | |
| let keyboardWillHide = NotificationCenter.default | |
| .publisher(for: UIResponder.keyboardWillHideNotification) | |
| .map { _ in CGFloat(0)} | |
| _ = Publishers.Merge(keyboardWillOpen, keyboardWillHide) | |
| .subscribe(on: RunLoop.main) | |
| .assign(to: \UIScrollView.contentInset.bottom, on: scrollView) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment