title: swift - Call a function between collectionview cell class and collectionview Controller
body: <p>Hi i have been struggle with this probleme for some time and cant figure it out.</p>
  
  <p>What i would like to do is, press a button inside a collectionview cell, and perform a transition to next cell.</p>
  
  <p>This is the function i want to call that is inside the the collectionview controller class:</p>
  
  <pre><code>func done(){
      let scrollIndex: NSIndexPath = NSIndexPath(item: 1, section: 0)// NSIndexPath(forItem: 0, inSection: 0)
      CollectionViewet.scrollToItem(at: scrollIndex as IndexPath, at: .centeredHorizontally, animated: true)
  }
  </code></pre>
  
  <p>What happens is that when i call a function from collectionview controller, it give me this</p>
  
  <blockquote>
    <p>Unexpectedly found nil while unwrapping an Optional value</p>
  </blockquote>
  
  <p>What i am doing wrong?</p>