title: How to push to a new viewController from UITableView?
body: <p>could someone help tell me where I'm going wrong? I'm trying to push to a new view controller from a table view but it's not doing anything, it prints in the console so its registering but it's not pushing.</p>
  <p><a href="https://i.stack.imgur.com/nU5Dn.png" rel="nofollow noreferrer">enter image description here</a></p>
  <pre><code>extension HostedVC: UITableViewDataSource {
      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
          return hostItems.count
      }
             
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
          let cell = tableView.dequeueReusableCell(withIdentifier: &quot;hostedCell&quot;, for: indexPath) as! HostedTableViewCell
          let post = hostItems[indexPath.row]
          cell.eventNameLable.text = post.eventName
          cell.eventNameLable.textColor = UIColor(red: 0.42, green: 0.33, blue: 0.56, alpha: 1.00)
          cell.dateLable.text = post.startDate
          cell.dateLable.textColor = UIColor.init(red: 61/255, green: 75/255, blue: 99/255, alpha: 1)
          cell.backgroundColor = UIColor.white
          cell.logo.image = UIImage(named: &quot;networkingIMG&quot;)
          let backgroundView = UIView()
          backgroundView.backgroundColor = UIColor(red: 0.73, green: 0.73, blue: 0.73, alpha: 1.00)
          cell.selectedBackgroundView = backgroundView
          cell.layer.masksToBounds = true
          return cell
      }
      
      func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -&gt; CGFloat {
          return 80
      }
      
      func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
          let iP = hostItems[indexPath.row]
          print(iP.eventName)
          UserDefaults.standard.set(iP.id, forKey: &quot;SelectedId&quot;)
          let vc = HistoryCellPageVC(event: iP)
          hostedVC?.navigationController?.pushViewController(vc, animated: true)
          tableView.deselectRow(at: indexPath, animated: true)
      }
      
      func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -&gt; Bool {
          return true
      }
  
      func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
          if (editingStyle == .delete) {
              // handle delete (by removing the data from your array and updating the tableview)
              hostItems.remove(at: indexPath.row)
                  tableView.deleteRows(at: [indexPath], with: .fade)
              } else if editingStyle == .insert {
          }
      }
      
      func openEvent(_ hostItems: Hosted) {
          let vc = HistoryCellPageVC(event: hostItems)
          navigationController?.pushViewController(vc, animated: true)
      }
  }
  </code></pre>