title: How do I use prepare segue with tableview cell?
body: <p>How do I take the text, author... and transfer it to another view controller? I don't understand how to retrieve the data and put it onto a segue and how to call the segue. I have made another view controller and connected the label and its called titleString</p>
  
  <pre><code>var posts = [postStruct]()
  var  downloadURL : String = ""
  
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
  
      let ref = Database.database().reference().child("Posts")
  
      ref.observeSingleEvent(of: .value, with: { snapshot in
  
          print(snapshot.childrenCount)
  
          for rest in snapshot.children.allObjects as! [DataSnapshot] {
  
              guard let value = rest.value as? Dictionary&lt;String,Any&gt; else { continue }
  
              guard let  title = value["Title"] as? String else { continue }
              guard let  downloadURL = value["Download URL"] as? String else { continue }
              guard let  author = value["Author"] as? String else { continue }
              guard let  date = value["Date"] as? String else { continue }
              guard let  article = value["Article"] as? String else { continue }
  
  
              let post = postStruct(title: title, author: author, date: date, article: article, downloadURL: downloadURL)
  
              self.posts.append(post)
  
  
          }
  
          self.posts = self.posts.reversed(); self.tableView.reloadData()
  
      })
  
  
  
  
  }
  
  
  override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
  
      var thePostView = segue.destination as! ArticleViewController
      thePostView.titleString = title!
  }
  
  
  
  
  override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return posts.count
  }
  
  override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
      let cell = tableView.dequeueReusableCell(withIdentifier: "cell")
  
      let label1 = cell?.viewWithTag(1) as! UILabel
      label1.text = posts[indexPath.row].title
  
  
      let imageView = cell?.viewWithTag(2) as! UIImageView
      let post = self.posts[indexPath.row];
      imageView.sd_setImage(with: URL(string: post.downloadURL), placeholderImage: UIImage(named: "placeholder"))
  
   return cell!
  
  
  
  
  
  }
  </code></pre>
  
  <p>}</p>