I want to rotate a UIImageView by roughly 10 degrees left/right but have a smooth animation, rather than a sudden turn which I see using:
UIImageView
play
Converted for Swift 3/4:
let animation = CABasicAnimation(keyPath: "transform.rotation") animation.fromValue = 0 animation.toValue = Double.pi * 2.0 animation.duration = 2 animation.repeatCount = .infinity animation.isRemovedOnCompletion = false imageView.layer.add(animation, forKey: "spin")