Created
May 18, 2021 13:15
-
-
Save matkuznik/9bdee47f6393e31a93e0c85edd019e13 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 duration = userInfo[UIResponder.keyboardAnimationDurationUserInfoKey] | |
.flatMap { $0 as? Double } ?? 0.25 | |
if duration > 0 { | |
let curve = userInfo[UIResponder.keyboardAnimationCurveUserInfoKey] | |
.flatMap { $0 as? Int } | |
.flatMap { UIView.AnimationCurve(rawValue: $0) } ?? .easeInOut | |
UIViewPropertyAnimator(duration: duration, curve: curve) { | |
viewController.view.layoutIfNeeded() | |
} | |
.startAnimation() | |
} else { | |
viewController.view.layoutIfNeeded() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment