title: Unclear why UIView.animate works smoothly, but with code outside the animation block
body: <p>I'm new to UIView animations &amp; am having trouble understanding the execution of this logic.  I've created an ImageView to hold an image, I've added a Tap Gesture Recognizer, set the UIImageView to "User Interaction Enabled" &amp; call an IBAction for that TGR.  Then I call the function below when the image is tapped.  The goal is to make the image 'pop' with a springy motion like it was punched, bouncing back to the image's original bounds so you can punch again.  It works exactly as I'd like (although I usually set withDuration to 0.25, I set it to 10 here to better see the animation).  However, I don't really understand why this works.  The last line smoothly sets the end bounds of the image to the original bounds size (which is what I want), but it does this smoothly EVEN THOUGH it's not part of the animation block in the closure.  If I eliminate the last line resetting the bounds for the image, the image will grow by 60 pixels in each direction after each execution (which is what I'd expect).  What I don't understand is: why does the last line in the function, self.imageToPunch.bounds = bounds, work smoothly and seemingly in conjunction with the animation block even if it's not inside that closure?</p>
  
  <pre><code>func animateImage() {
  
      // Create a variable holding the bounds of the image
      let bounds = self.imageToPunch.bounds
  
      // Setup and execute the animation
      UIView.animate(withDuration: 10.00, delay: 0.0, usingSpringWithDamping: 0.2, initialSpringVelocity: 10, options: [], animations: {
          self.imageToPunch.bounds = CGRect(x: bounds.origin.x - 60, y: bounds.origin.y - 60, width: bounds.size.width + 60, height: bounds.size.height + 60)
  
          }, completion: nil)
  
      // Reset the bounds of button so it doesn't grow (remember we spring 60 pixels from the corners)
      // self.imageToPunch.bounds = bounds
      self.imageToPunch.bounds = bounds
  }
  </code></pre>