Last active
November 22, 2018 16:16
-
-
Save gmoraleda/ddd24278c159dd21ec216ca130b28b50 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 keyboard = KeyboardObserver() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
keyboard.observe { [weak self] (event) -> Void in | |
guard let self = self else { return } | |
switch event.type { | |
case .willShow, .willHide, .willChangeFrame: | |
// React to the keyboard and adapt your UI | |
updateInsets(for: event, scrollView: self.scrollView) | |
default: | |
break | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment