I'm passing the data from one VC back to the first VC. I'm using this code:
@IBAction func goBack(_ sender: Any) {
    dismiss(animated: true, completion: nil)
    print(self.entryField.text!)
    performSegue(withIdentifier: "sendText", sender: self)
 }
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    let destVC = segue.destination as! ViewController
    let printName = self.entryField.text!
    print(self.entryField.text!)
    destVC.nameToDisplay=printName
}
This is my code of the VC in which the data is.
The code of the VC in which I want to display my result.
var nameToDisplay = ""
override func viewWillAppear(_ animated: Bool) {
    titleDisplay.text=nameToDisplay
}
I'm unable to pass the data, I tried printing the nameToDisplay but it gives empty string.