Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
private extension RequestCameraAuthorizationView {
// ...
func animateInView(view: UIView, delay: TimeInterval) {
view.alpha = 0
view.transform = CGAffineTransform(translationX: 0, y: -20)
let animation = UIViewPropertyAnimator(duration: 0.2, curve: .easeInOut) {
view.alpha = 1
view.transform = .identity
}
animation.startAnimation(afterDelay: delay)
}
func animateOutView(view: UIView, delay: TimeInterval, completion: (() -> Void)? = nil) {
let animation = UIViewPropertyAnimator(duration: 0.2, curve: .easeInOut) {
view.alpha = 0
view.transform = CGAffineTransform(translationX: 0, y: -20)
}
animation.startAnimation(afterDelay: delay)
animation.addCompletion { _ in
completion?()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment