I am trying to make this UIView rotate forever:
let options = UIViewAnimationOptions.autoreverse.union(UIViewAnimationOptions.repeat)
UIView.animate(withDuration: 5, delay: 0, options: options, animations: {
self.transform = CGAffineTransform(rotationAngle: CGFloat(2 * M_PI))
}, completion: { _ in })
Currently it does nothing because the rotation angle is the same position is it on right now. When I try something like M_PI it works and goes back and forth like it should, however it only does it halfway.
I am wondering how I can continue this rotation forever in a full 360 degree motion.
I tried this: UIView Infinite 360 degree rotation animation? which has the same issue I do, but I cannot figure out how to get it to work since Obj-C -> Swift has many changes. Would rather use UIView.animate other than CAAnimation, but not sure if that is the only other way.