Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hashaam/bcc4ce2a4778a9c1b3d866e56cad99d6 to your computer and use it in GitHub Desktop.
Save hashaam/bcc4ce2a4778a9c1b3d866e56cad99d6 to your computer and use it in GitHub Desktop.
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