title: Embed a UIView animation in a func that needs to return once the animation is completed
body: <p>This sounded simple, but I haven't been able to figure it out.</p>
  
  <p>Context: a VC tells a view to animate itself and the VC waits the animation to be completed before.</p>
  
  <p>I thought about doing something like this:</p>
  
  <p>In ViewController:</p>
  
  <pre><code>loadingView.animate()
  </code></pre>
  
  <p>In LoadingView (UIView subclass):</p>
  
  <pre><code>animate() -&gt; Bool {
      UIView.animate(withDuration: 1.0, animations: {
          self.imageViewCenterYConstraint.constant -= 20
          self.layoutIfNeeded()
      }, completion {
           return true // This line obviously doesn't work.
      })
  }
  </code></pre>
  
  <p>I do not want to include the rest of the code inside the completion block. The rest of the code is in the VC.</p>
  
  <p>I suspect that all this should rather be done with an additional completion handler to add to the animate func.</p>
  
  <p>PS: Just in case you know of a better solution/best practices, here is more context: I display a loading animation and remove it once I have retrieved data from the network. I always want to wait for the animation to complete before removing, even if the network data was already downloaded. Don't want to stop the animation at half of it.</p>