I have a UIView animation that I want to reverse and repeat 5 times. Prior to iOS 13, I used the following code -
UIView.animate(
withDuration: 0.5,
delay: 0.0,
options: [.repeat, .autoreverse],
animations: {
UIView.setAnimationRepeatCount(5.0)
//stuff to be animated
},
completion: {(hasFinished:Bool) in
}
)
Now it seems that from iOS 13 onwards, UIView.setAnimationRepeatCount is deprecated. Xcode gives a deprecation warning with the message "use the block based animation API instead". I've searched the docs and cant seem to find a substitute.
What is the alternative process to repeat and reverse an animation a fixed number of times?