title: How to perform segue from a didSelectRowAt
body: <p>I am stuck with this simple task to perform segue from a selected cell.</p>
  
  <p>I've created a segue from one ViewController to another with an identifier "showDetails". Than I try this code:</p>
  
  <pre class="lang-swift prettyprint-override"><code>func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
      performSegue(withIdentifier: "showDetails", sender: self)
  }
  
  override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
      if segue.identifier == "showDetails",
      let destination = segue.destination as? DetailsViewController {
          let indexPath = tableView.indexPathForSelectedRow!
          destination.rideIndex = indexPath.row
      }
  }
  </code></pre>
  
  <p>Apparently it doesn't work. What am I doing wrong?</p>