title: Perform segue programmatically and still have it in the storyboard
body: <p>I want to segue from a tableview that is embedded in a navigation controller to another view controller once I clicked on a table cell. I still want that second view controller to be embedded in the same navigation controller. Hence, I created the segue via storyboard.</p>
  
  <p>However, I want to conditionally check after tapping on the cell if the segue should be performed or not.</p>
  
  <p>I already checked out the method <code>shouldPerformSegueWithIdentifier</code>, which would satisfy my needs, but unfortunately, it is executed before the table click handler. If I remove the storyboard segue and just segue via <code>performSegue</code>, my second view controller is not embedded in the same navigation controller anymore.</p>
  
  <p>Any advice?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>// Called on click event on table cell
  func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
      tableView.deselectRow(at: indexPath, animated: true)
      let app = apps[indexPath.section]
      if app.state == .INSTALLED {
          let inputVC = self.navigationController?.viewControllers[1] as? InputVC
          inputVC?.app = app
          performSegue(withIdentifier: "showAccSync", sender: self)
      } else {
          // show alert
      }
  }
  </code></pre>