title: Start/stop image view rotation animations
body: <p>I have a start/stop button and an image view which I want to rotate.</p>
  
  <p>When I press the button I want the to start rotating and when I press the button again the image should stop rotating. I am currently using an <code>UIView</code> animation, but I haven't figured out a way to stop the view animations. </p>
  
  <p>I want the image to rotate, but when the animation stops the image shouldn't go back to the starting position, but instead continue the animation.</p>
  
  <pre><code>var isTapped = true
  
      @IBAction func startStopButtonTapped(_ sender: Any) {
         ruotate()
         isTapped = !isTapped
      }
  
      func ruotate() {
          if isTapped {
              UIView.animate(withDuration: 5, delay: 0, options: .repeat, animations: { () -&gt; Void in
              self.imageWood.transform =     self.imageWood.transform.rotated(by: CGFloat(M_PI_2))
              }, completion: { finished in
              ruotate()
              })
      }  }
  </code></pre>
  
  <p>It is my code, but it doesn't work like I aspect.</p>