Skip to content

Instantly share code, notes, and snippets.

Last active Apr 26, 2020
What would you like to do?
Combine animations
CATransaction.begin() //Start of animation transaction
CATransaction.setCompletionBlock { //Transaction is Ready
heightConstraint.constant = 80.0
UIView.animate(withDuration: 2.0) { // UIView type of animation
let cornerAnimation = CABasicAnimation(keyPath: #keyPath(CALayer.cornerRadius)) // CALayer type of animation
cornerAnimation.fromValue = 0
cornerAnimation.toValue = 12
view.layer.add(cornerAnimation, forKey: #keyPath(CALayer.cornerRadius))
CATransaction.commit() //End of animation transaction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment