title: Performing Segue to a new viewcontroller - prepare for segue fails swift 5
body: <p>I'm trying to perform a <code>segue</code> to another <code>UIViewController</code>.</p>
  
  <p>I wish to pass data to that new controller. However, looks like the <code>UILabels</code> of the new <code>UIViewController</code> are not yet initialised, so I'm an error which states that I'm unwrapping a nil-value optional.</p>
  
  <p>What am I missing?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath)
  {
      let cell = collectionView.cellForItem(at: indexPath)
      collectionView.deselectItem(at: indexPath, animated: true)
  
      performSegue(withIdentifier: "addProductSegue", sender: cell)
  }
  
  override func prepare(for segue: UIStoryboardSegue, sender: Any?)
  {
      if let nextViewController = segue.destination as? AddProductsViewController
      {
          let productCell = sender as! ProductCell
  
          nextViewController.productName!.text = productCell.product!.Name
          nextViewController.priceForKg!.text = "\(productCell.product?.priceForKg ?? 0.0)"
          nextViewController.productImage!.image = productCell.productImageView.image
      }
  }
  </code></pre>
  
  <p>And the new <code>UIViewController</code>:</p>
  
  <pre><code>import UIKit
  
  class AddProductsViewController: UIViewController
  {
      @IBOutlet weak var productName: UILabel!
      @IBOutlet weak var priceForKg: UILabel!
      @IBOutlet weak var productImage: UIImageView!
  
      override func viewDidLoad()
      {
          super.viewDidLoad()
      }
  
      @IBAction func addProduct(_ sender: UIButton)
      {
          self.navigationController?.popViewController(animated: true)
      }
  }
  </code></pre>