title: Triggering a function by swiping through UICollectionView with single cell displayed
body: <p>I'm currently making a Pokedex app and it's my first app.</p>
  
  <p>Here is a screenshot of the view I'm working with. <a href="http://imgur.com/aE2g4kL" rel="nofollow">http://imgur.com/aE2g4kL</a> </p>
  
  <p>Screenshot is taken mid swipe to show how I want to trigger UI updates.</p>
  
  <p>The top bar with pictures of the Pokemon is a UICollectionView that displays a single UICollectionViewCell. I want trigger a function to update the UI to the next Pokemon when the pictures is halfway off the screen.</p>
  
  <p>I have tried the following:</p>
  
  <ul>
  <li><p>func UICollectionView didEndDisplayingCell</p></li>
  <li><p>func UICollectionView cellForItemAtIndexPath</p></li>
  <li><p>func UICollectionView willDisplayCell</p></li>
  </ul>
  
  <p>The issue with these is that they trigger too late or too early.</p>
  
  <p>I also tried using a content offset with scrollViewDidScroll:</p>
  
  <pre><code>func scrollViewDidScroll(scrollView: UIScrollView) {
  
      let bounds = UIScreen.mainScreen().bounds
      let width = bounds.size.width
      let offset = self.collectionView.contentOffset.x
  
      var pokeID = Int((offset-width/2)/width+2) {
          didSet {
              print("Change Detected")
          }
      }
      print(offset)
      print(pokeID)
  }
  </code></pre>
  
  <p>This code prints the correct Pokemon. I tried using willSet and didSet to trigger the change in the 'pokeID' but didn't have any luck.
  Anyone have any ideas on how I could achieve this?</p>