func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let tableRow = indexPath.row
var controllerToPresent: UIViewController
if tableRow == 0 {
// инстанциируем через Storyboard или как угодно
controllerToPresent = FirstViewController()
} else {
controllerToPresent = SecondViewController()
}
self.present(controllerToPresent, animated: true)
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
guard let indexPath = tableView.indexPathForSelectedRow else { return }
DispatchQueue.main.async {
self.navigationController?.pushViewController(YOUR CONTROLLER, animated: true)
}
}