title: UIScrollView Paging with Animation Completion Handler
body: <p>I have a UIScrollview with buttons that I use for paging right and left:</p>
  
  <pre><code>@IBAction func leftPressed(sender: AnyObject) {
  
      self.scrollView!.setContentOffset(CGPointMake(0, 0), animated: true)
  } 
  </code></pre>
  
  <p>I'd like to perform an action after the scrollview has finished the paging animation.  Something like:</p>
  
  <pre><code>@IBAction func leftPressed(sender: AnyObject) {
  
      self.scrollView!.setContentOffset(CGPointMake(0, 0), animated: true)
  
      secondFunction()
  }
  </code></pre>
  
  <p>The above code doesn't work because the second function runs before the scrollview is finished animating the offset.  My initial reaction was to use a completion handler but I'm not sure how to apply one to the setContentOffset function.  I've tried:</p>
  
  <pre><code>func animatePaging(completion: () -&gt; Void) {
  
      self.mainScrollView!.setContentOffset(CGPointMake(0, 0), animated: true)
  
      completion()
  }
  </code></pre>
  
  <p>with the call</p>
  
  <pre><code>animatePaging(completion: self.secondFunction())
  </code></pre>
  
  <p>But I get the error "Cannot invoke 'animatePaging' with an argument list of type '(completion())'.  Any thoughts?</p>