2

with the UIView.animate: method , we can configure the options and make it [.autoreverse,.repeat]. here is a simple Animation:

@IBOutlet weak var v1: UIView!
 UIView.animate(withDuration: 3, delay: 0, options: [.autoreverse,.repeat], animations: {
                self.v1.frame = self.v1.frame.offsetBy(dx: 100, dy: 0)
            }, completion: nil)

this code will animate the v1 moving it forward and back repeatedly, how can I do it with UIViewPropertyAnimator?(I want to the the advantage of stop and pause)

Shadi Asi
  • 157
  • 13
  • https://stackoverflow.com/questions/49418128/repeating-and-reversing-an-animation-multiple-times-using-uiviewpropertyanimator – dengApro Jun 21 '20 at 14:15

1 Answers1

1

UIViewPropertyAnimator doesn't provide a way to do repeated animations. You need to use the old UIView animate class methods.

Mojo66
  • 1,109
  • 12
  • 21