Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save myrickchow32/4ba8f2ab001ac1a6b7b30c18c422ca1f to your computer and use it in GitHub Desktop.
Save myrickchow32/4ba8f2ab001ac1a6b7b30c18c422ca1f to your computer and use it in GitHub Desktop.
func transitionAnimation(view: UIView, animationOptions: UIView.AnimationOptions, isReset: Bool) {
// Combine transition annimation option with other animation options
let combinedAnimationOptions: UIView.AnimationOptions = [animationOptions, .allowUserInteraction, .autoreverse, .repeat]
UIView.transition(with: view, duration: durationOfAnimationInSecond, options: combinedAnimationOptions, animations: {
view.backgroundColor = UIColor.init(named: isReset ? "darkGreen" : "darkRed")
}, completion: nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment