title: Taking a snapshot of a UICollectionViewCell
body: <p>I am making a tvOS app and I want it to look similarly to the Movies app. Therefore I have a <code>UICollectionView</code>. Now my cells are not just simple <code>UIImageView</code>s, but are rather somewhat more complicated.</p>
  
  <p>I still want to have the nice focus visual effect (making the cell image bigger and having the light effect on it when the user swipes the remote). So what I am trying to do is render my cell, then take a snapshot of it and then show this snapshot instead of the cell itself. This is how I do it:</p>
  
  <pre><code>extension UIView {
      var snapshot : UIImage {
          UIGraphicsBeginImageContextWithOptions(bounds.size, true, 0.0)
          drawViewHierarchyInRect(self.bounds, afterScreenUpdates: true)
          let image = UIGraphicsGetImageFromCurrentImageContext()
          UIGraphicsEndImageContext()
          return image
      }
  }
  </code></pre>
  
  <p>...</p>
  
  <pre><code>func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -&gt; UICollectionViewCell {
      let cell = NSBundle.mainBundle().loadNibNamed("ContentCell", owner: self, options: nil)[0] as! ContentCell
      cell.update()
      let cellSnapshot = cell.snapshot
  
      let snapshotCell = collectionView.dequeueReusableCellWithReuseIdentifier("SnapshotCell", forIndexPath: indexPath) as! SnapshotCell
      snapshotCell.snapshotImageView.image = cellSnapshot
      return snapshotCell
  }
  </code></pre>
  
  <p>However, all this does is show a black cell. Any ideas what might I be doing wrong?</p>