I am creating my own custom activity indicator. I created a circular view with CAShapeLayer and I managed to stroke the circular layer but I want to do it indefinitely until the user wants to stop. The following is my stroke layer animation code.
private func getStrokeEndAnimation()->CABasicAnimation{
let animation = CABasicAnimation(keyPath: "strokeEnd")
animation.fromValue = 0.0
animation.toValue = 1.0
animation.duration = 2.0
animation.fillMode = .forwards
animation.isRemovedOnCompletion = false
return animation
}
There is an instance property on BasicAnimation named repeatCount
but if I specify that my activity indicator will animate the given number of times like if I do
animation.repeatCount = 3
it will animate only 3 times. How can I make sure that the animation keeps going indefinitely until, I stop it.
animation.repeatCount = .greatestFiniteMagnitude
will for all practical purposes repeat it forever.