Skip to content

Instantly share code, notes, and snippets.

@myrickchow32
Last active January 5, 2019 13:25
Show Gist options
  • Save myrickchow32/409bcb02efe3d030fc5c8676447c6461 to your computer and use it in GitHub Desktop.
Save myrickchow32/409bcb02efe3d030fc5c8676447c6461 to your computer and use it in GitHub Desktop.
func curveAnimation(view: UIView, animationOptions: UIView.AnimationOptions, isReset: Bool) {
// Solution: Combine with .allowUserInteraction
let combinedAnimationOptions: UIView.AnimationOptions = [animationOptions, .allowUserInteraction]
let defaultXMovement: CGFloat = 240
UIView.animate(withDuration: durationOfAnimationInSecond, delay: 0, options: combinedAnimationOptions, animations: {
view.transform = isReset ? .identity : CGAffineTransform.identity.translatedBy(x: defaultXMovement, y: 0)
}, completion: nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment