-3

I currently have a tableViewController that is being populated with data sent from the previous viewController with prepareForSegue. I'm now trying to send the data back based on the cell that the user selects so that I can save the item the user selected.

I figure that the best way to go about this is to use an unwindSegue, but I am unsure how best to implement it. Can someone point me in the right direction?

Khledon
  • 193
  • 5
  • 23

1 Answers1

0

Here you need a delegate inside prepareForSegue set

let des = segue.destination as! NextVC
des.delegate = self

then inside the nextVC access the previousVC and save any data , you may use delegate?.tableView.indexPathForSelectedRow if you not currently pass the index

Shehata Gamal
  • 98,760
  • 8
  • 65
  • 87