I'm trying to make a communication between tableview and it's detail view
Please can you check my way and give me some advices
So, I embedded Navigation Controller to Table view
and I didn't use tableview(_:didSelectedRowAt) method.
Some answers in Stackoverflow, they said override prepare(:) method and write theperformSegue(withIdentifier:) method in the tableview(_:didSelectedRowAt)
but if i write the code like above two screens were shown.
(I think because segue action are triggered twice)
I just drag and drop the segue action(push) to Detail View from table view cell (Friends Name Cell)
By using this segue action, i can pass the data by prepare(:segue) method for editing selected friend name at the Detail View
and if i edit friend name from detail view's text field, there is edit button which trigger the unwind segue
so I override prepare(:segue) method in Detail View Controller
and wrote code below at Table View's ViewController
@IBAction func getEditedNameFromDetailView(_ sender:UIStoryboardSegue){
if sender.source is DetailViewController {
if let senderVC = sender.source as? DetailViewController {
data[(self.someTableView.indexPathForSelectedRow?.row)!] = senderVC.editedData!
}
someTableView.reloadData()
}
}
is this a proper way to communicate table view and its detail view?