title: Present AlertView from UICollectionViewCell
body: <p>I have a button in my UICollectionViewCell.swift: I want, based on certain parameters for it to be able to present an alert. </p>
  
  <pre><code>class CollectionViewCell: UICollectionViewCell {
       var collectionView: CollectionView!
  
   @IBAction func buttonPressed(sender: UIButton) {
  
      doThisOrThat()
  }
  
  
  func doThisOrThat() {
      if x == .NotDetermined {
          y.doSomething()
      } else if x == .Denied || x == .Restricted {
              showAlert("Error", theMessage: "there's an error here")
              return
          }
      }
  
  func showAlert(title: String, theMessage: String) {
      let alert = UIAlertController(title: title, message: theMessage, preferredStyle: UIAlertControllerStyle.Alert)
      alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
      self.collectionView!.presentViewController(alert, animated: true, completion: nil)
  }
  </code></pre>
  
  <p>On the <code>self.collectionView!.presentViewController</code> line I get a break:</p>
  
  <p><code>fatal error: unexpectedly found nil while unwrapping an Optional value</code></p>
  
  <p>I'm guessing that this has someting to do with how <code>CollectionView</code> is being used - I don't totally understand optionals yet. I know that a <code>UICollectionCell</code> can't <code>.presentViewController</code> - which is why I'm trying to get <code>UICOllectionView</code> to do it. </p>
  
  <p>How do I make this work? I've thought of using an <code>extension</code> but don't know how to make <code>UICOllectionViewCell</code> adopt <code>.presentViewController</code></p>
  
  <p>Any ideas?</p>