Skip to content

Instantly share code, notes, and snippets.

@dimkagithub
Last active November 6, 2021 06:51
Show Gist options
  • Save dimkagithub/59b2c7fd343713fd8f184c6795c37266 to your computer and use it in GitHub Desktop.
Save dimkagithub/59b2c7fd343713fd8f184c6795c37266 to your computer and use it in GitHub Desktop.
UIIMageView Extension
extension UIImageView {
func rotate() {
let rotation : CABasicAnimation = CABasicAnimation(keyPath: "transform.rotation.x")
rotation.toValue = NSNumber(value: Double.pi * 2)
rotation.duration = 2
rotation.isCumulative = true
rotation.repeatCount = Float.greatestFiniteMagnitude
self.layer.add(rotation, forKey: "rotationAnimation")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment