Skip to content

Instantly share code, notes, and snippets.

@alexnikol
Last active April 26, 2020 17:05
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 alexnikol/e5065efa9423251de47f33764a310d4a to your computer and use it in GitHub Desktop.
Save alexnikol/e5065efa9423251de47f33764a310d4a to your computer and use it in GitHub Desktop.
Combine animations
CATransaction.begin() //Start of animation transaction
CATransaction.setCompletionBlock { //Transaction is Ready
print("READY")
}
heightConstraint.constant = 80.0
UIView.animate(withDuration: 2.0) { // UIView type of animation
view.layoutIfNeeded()
}
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