title: How to get tableview data to a detailsViewController
body: <p>I am currently working on an app that puts API data into tableview then view the data in a detailsViewController.</p>
  
  <p>My code looks about right to me, and I'm beginning to wonder maybe all the information should be in the tableview for me to pass the data to another controller. Is it possible to pass data to another controller without having to put all the information in the tableview cell?</p>
  
  <p>EDIT: If I were to fetch data in my detailsViewController from the fetchedSpell array, how would I let the detailsViewController know which data to show based on the clicked cell?</p>
  
  <p>I've already tried passing it through but nothing is showing in the details controller when i click on the cell. </p>
  
  <p>Table View Select</p>
  
  <pre><code>func tableView(_ tableView: UITableView, didSelectRowAt indexPath: 
    IndexPath) {
  
      let storyBoard: UIStoryboard = UIStoryboard(name:"Main", 
  bundle: nil)
      let SpellDetailsViewController = 
  storyBoard.instantiateViewController(withIdentifier: 
   "SpellDetailsViewController") as! SpellDetailsViewController
      let detail = fetchedSpell[indexPath.row]
  
      SpellDetailsViewController.spellText = detail.spell
      SpellDetailsViewController.effectText = detail.effects
      SpellDetailsViewController.typeText = detail.types
  
      self.present(SpellDetailsViewController, animated: true, 
  completion: nil)
  }
  </code></pre>
  
  <p>Spell Details Controller</p>
  
  <pre><code>class SpellDetailsViewController: UIViewController, 
  UINavigationControllerDelegate {
  @IBOutlet weak var spellLabel: UILabel!
  @IBOutlet weak var typeLabel: UILabel!
  @IBOutlet weak var effectLabel: UILabel!
  
  var spellText: String!
  var typeText: String!
  var effectText : String!
  override func viewDidLoad() {
      super.viewDidLoad()
  
      spellLabel.text = spellText
      typeLabel.text = typeText
      effectLabel.text = effectText
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/R16v8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/R16v8.png" alt="Tablieview and Details Page"></a></p>