title: SWIFT - UITableViewCell updating based on selection
body: <p>I have a TableViewController (lets call TVC1) with a row that says "OD" (which stands for Outer Diameter).</p>
  
  <p>Upon selecting this row, a bunch of rows in a new TableViewController (lets call TVC2) containing the various OD (casingOD in my code) shows. What I want to happen is when the user selects the OD it will segue back to the main TableViewController with the string that corresponds to the user selection. My code for this currently fails...Could anyone help point me in the right direction? If you require TVC1 code i'll happily post it, i'm just trying to save any unneccessary code reading for you folks :) </p>
  
  <p>My TVC2 code is as follows:</p>
  
  <pre><code>import UIKit
  
  class CasingSelectionTableViewController: UITableViewController {
  
  var selectedData: Data?
  
  let casingOD = ["114.3", "127.0", "139.7", "168.3" , "177.8", "193.7", "219.1", "244.5", "247.6", "273.1", "298.4", "298.4", "339.7", "406.4", "473.0", "508"]
  
  override func viewDidLoad() {
      super.viewDidLoad()
  }
  
  override func viewWillAppear(animated: Bool) {
      switch selectedData! {
  
      case .OuterDiameter:
          print(casingOD)
  
      case .Weight:
          print(casingWeight114) // I deleted the casingWeight114 line of code as its not required for this question
  
      case .InnerDiameter:
          print(id114) // I deleted the id114 line as its not required for this question
      }
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  
  // MARK: - Table view data source
  
  override func numberOfSectionsInTableView(tableView: UITableView) -&gt; Int {
      // #warning Incomplete implementation, return the number of sections
      return 1
  }
  
  override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      // #warning Incomplete implementation, return the number of rows
      return casingOD.count
  
  }
  
  
  override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
  
      var casingSpec: UITableViewCell!
  
      if selectedData == Data.OuterDiameter {
          casingSpec = tableView.dequeueReusableCellWithIdentifier("selectedCasingSpec", forIndexPath: indexPath)
          let casingODSpec = casingOD[indexPath.row]
          casingSpec.textLabel?.text = casingODSpec
          return casingSpec
      } else {
          return casingSpec
      }
  
  }
  
  override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
      let selection: UITableViewCell!
      selection.textLabel?.text = indexPath.row as! String
  
  }
  </code></pre>