title: sending customCell label text to destination view
body: <p>I am stuck on this problem. I am downloading a json file from Firebase and successfully displaying in a TableView. That TableView has a custom cell with two labels. I have set up a segue link from the custom cell to a Detail ViewController. That works fine, but now I want to take the text content of the cell labels and send to a destination ViewController. </p>
  
  <p>I have had no trouble doing this in the past, but am having trouble implementing this from the label.text in a custom cell.</p>
  
  <p>I am using label tags (label1 and label2, although I may change that to the label names sometime).</p>
  
  <p>The question is, how do I get the text contents from the two labels from the row selected and pass those to the DetailViewController? All my attempts so far have failed.  Is there something I should be doing in the:</p>
  
  <pre><code>  valueToPass = currentCell?.textLabel?.text 
  </code></pre>
  
  <p>Here is the code:</p>
  
  <pre><code>  struct postStruct {
    let property : String!
    let propType : String!
    }
  
  class TableViewController: UITableViewController {
  
  var posts = [postStruct]()
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      self.tableView.delegate = self
      self.tableView.dataSource = self
  
      let databaseRef = FIRDatabase.database().reference()
  
    databaseRef.child("users").queryOrderedByKey().observe(.childAdded, with: {
          snapshot in
  
          let snapshotValue = snapshot.value as? NSDictionary
          let property = snapshotValue!["property"] as? String
  
          let propType = snapshotValue!["type"] as? String
  
          self.posts.insert(postStruct(property: property, propType: propType), at: 0)
          self.tableView.reloadData()
      })
    }
  
      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].property
  
     let label2 = cell?.viewWithTag(2) as! UILabel
      label2.text = posts[indexPath.row].propType
    //  print(posts)
    //  cell.setcell(valueToPass.label1)
        return cell!
  }
  
  override func numberOfSections(in tableView: UITableView) -&gt; Int {
      return 1
  }
  
  var valueToPass:String!
  
  func tableView(tableView: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!) {
  
      // Get Cell Label
      let indexPath = tableView.indexPathForSelectedRow;
      let currentCell = tableView.cellForRow(at: indexPath!) as UITableViewCell!;
  
     valueToPass = currentCell?.textLabel?.text 
      performSegue(withIdentifier: "detailSegue", sender: self)
         }
  </code></pre>
  
  <p>Any help most welcome, in particular code examples. Many thanks in anticipation</p>