title: Passing an Object Through a Storyboard Segue
body: <p>I have the following segue in a <code>TableViewController</code> and each table row has a Fruit object. I want to pass each row's object to a view controller that shows more details about the object in a row, so I've written the segue below to transfer the Fruit object across view controllers. </p>
  
  <p>In the <code>FruitDescriptionViewController</code>, I couldn't figure out how to define the variable that will take on the object from the row because it won't let me define a variable <code>var chosenFruit = Fruit</code> and in the segue, I get the error <code>cannot pass type Fruit to type Fruit.type</code></p>
  
  <p>How would I go about passing the Fruit object via segue and storing it in a Fruit variable in the <code>FruitDescriptionViewController</code>?</p>
  
  <pre><code>override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
          if segue.identifier == "FruitDetails" {
              if let indexPath = tableView.indexPathForSelectedRow {
                  var fruit = fruits[indexPath.row]
                  let controller = segue.destination as? FruitDescriptionViewController
                  controller?.chosenFruit = Fruit(name: fruit.name, url: fruit.url, fruitArray: fruit.fruitArray)
              }
          }
  
      }
  </code></pre>