title: Prepare For Segue on return
body: <p>So the code I am trying to implement in Swift is based upon this answer here for passing data back from a ViewController:
  <a href="https://stackoverflow.com/a/49206460/6184696">Passing Data with a Callback</a></p>
  
  <p>Now my issue is after I have called: </p>
  
  <pre><code>self.navigationController?.popViewController(animated: true)
  </code></pre>
  
  <p>The Prepare For Segue function isn't called in my original View Controller. I assume it shouldn't be called anyway but from that answer I assume there is a possible way to do so? </p>
  
  <hr>
  
  <p><strong>First View Controller Snippets</strong></p>
  
  <pre><code>override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
  
      //ignore this segue identifier here, this function works when I am showing a new VC
      if(segue.identifier == "certSegue"){
          let certVC = segue.destination as! CertificateViewController
          certVC.profileModel = profileModel
      }
  
      //this is what I need to be called
      if(segue.identifier == "dpSegue"){
          print("dpSegue")
          let dpVC = segue.destination as! DatePickerViewController
          dpVC.callback = { result in
              print(result)
              print("Data")
              // do something with the result
          }
          //dpVC.dailyBudgetPassedThrough = "Test"
      }
  }
  
   func showDatePicker(){
      let vc = UIStoryboard.init(name: "Main", bundle: Bundle.main).instantiateViewController(withIdentifier: "DatePickerVC") as? DatePickerViewController
      self.navigationController?.pushViewController(vc!, animated: true)
  
  }
  </code></pre>
  
  <p><strong>Second View Controller</strong></p>
  
  <pre><code>import UIKit
  
  class DatePickerViewController: UIViewController {
  
      var callback : ((String)-&gt;())?
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      // Do any additional setup after loading the view.
  }
  
  func sendBackUpdate(){
  
     print("Callback")
      callback?("Test")
  }
  
  @IBAction func cancelButton(_ sender: Any) {
      self.navigationController?.popViewController(animated: true)
  }
  
  @IBAction func updateButton(_ sender: Any) {
      sendBackUpdate()
      self.navigationController?.popViewController(animated: true)
  }
  
  
  }
  </code></pre>