I am trying to get a textfield in the second view controller to show the name of the cell clicked in a first view controller. When using a table view, should I push like below, or present as shown below. This is the current code I have
NearbyViewController
     func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    let cell = UITableViewCell(style: .default, reuseIdentifier: "cell")
    var (cellName) = myList[indexPath.row]
     let viewController = storyboard?.instantiateViewController(withIdentifier: "Home2") as! ShopViewController
    viewController.name = cellName
    navigationController?.pushViewController(viewController, animated: true)
    let vct = self.storyboard?.instantiateViewController(withIdentifier: "Home2")
    self.present(vct!, animated: true, completion: nil)
    print("row\(indexPath.row)")
    print("name: \(cellName)")
}
ShopViewController
var name :String?
@IBOutlet weak var myTextField: UITextField!
override func viewDidLoad() {
        print(name)
}
 
    
 
     
    