title: pass an image from one view controller to another (swift) with Firebase
body: <p>i am trying to pass an image from one view controller to another but i am getting an error in prepare for segue function</p>
  
  <pre><code>func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -&gt; UICollectionViewCell {
  
  
          let post = posts[indexPath.row]
  
          if let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath)as? collectionViewCellBooks {
  
              if let img = booksVC.imageCache.object(forKey: post.imageUrl as NSString) {
                  cell.configureCell(post: post, img: img)
                  return cell
  
          }else {
  
                  cell.configureCell(post: post)
                  return cell
              }
          }
              else {
                  return collectionViewCellBooks()
              }
  
      }
  
      func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
          self.performSegue(withIdentifier: "showImage", sender: self)
      }
  
  
  
      override func prepare(for segue: UIStoryboardSegue, sender: Any?)
      {
  
           if segue.identifier == "showImage"
           {
  
           let indexPaths = self.collectionView!.indexPathsForSelectedItems!
           let indexPath = indexPaths[0] as IndexPath
           let vc = segue.destination as! newViewController
          // vc.image = self.posts[(indexPath as NSIndexPath).row]
              vc.image = self.posts[indexPath.row]
           }
  
  
  
  
  
  class newViewController: UIViewController {
  
      @IBOutlet weak var imageView: UIImageView!
  
      var image = UIImage()
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          self.imageView.image = self.image
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
      }
  }
  </code></pre>
  
  <p>this is my Post class </p>
  
  <p>class Post {</p>
  
  <pre><code>private var _caption: String!
  private var _imageUrl: String!
  private var _postKey: String!
  
  
  
  var caption: String {
      return _caption
  }
  
  var imageUrl: String {
      return _imageUrl
  }
  
  var postKey: String {
      return _postKey
  }
  
  
  init(caption: String, imageUrl: String) {
  
      self._caption = caption
      self._imageUrl = imageUrl
  }
  
  init(postKey: String, postData: Dictionary&lt;String, AnyObject&gt;) {
  
      self._postKey = postKey
  
      if let caption = postData["title"] as? String {
          self._caption = caption
      }
      if let imagesUrl = postData["imageURL"] as? String {
          self._imageUrl = imagesUrl
      }
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>title and imageURL are saved on firebase database </p>