title: How to pass images through segue into new view controller?
body: <p>I am trying to pass an image into a new view controller via a segue. I was able to transfer the title into the view controller, but I keep getting the error: &quot;Cannot convert value of type 'UIImage?.Type' to expected argument type 'String'&quot;. Here's code:</p>
  <pre><code>import UIKit
  
  class DetailViewController: UIViewController {
  
     var name = &quot;&quot;
      var img: UIImage?
      
      @IBOutlet weak var detailCrystalNameLabel: UILabel!
      @IBOutlet weak var detailCrystalPhotoImageView: UIImageView!
      override func viewDidLoad() {
          super.viewDidLoad()
          
          title = name
          detailCrystalPhotoImageView.image = UIImage(named: img)
  
      }
  }
  </code></pre>
  <p>This is the code from the view controller:</p>
  <pre><code>func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -&gt; UICollectionViewCell {
          let cell = collectionView.dequeueReusableCell(withReuseIdentifier: &quot;MainCollectionViewCell&quot;, for: indexPath) as! MainCollectionViewCell
          cell.crystalPhotoImageView.image = imageArray[indexPath.row]
          
          
          return cell
      }
      
      func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
          let vc = storyboard?.instantiateViewController(identifier: &quot;DetailViewController&quot;) as? DetailViewController
          
          vc?.name = nameArray[indexPath.row]
          vc?.img = imageArray[indexPath.row]
          
          self.navigationController?.pushViewController(vc!, animated: true)
      }
  }
  </code></pre>