I'm in trouble with a stupid error. When I run the application my segue work twice. I have a tableview with a lot of sections and rows and when the user click on a row I want to perform the segue and programmatically change a text view in the destination view. When I run the program and I click on the tableview the segue works twice. What's the problem?
Here is my code for the segue:
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
print("section: \(indexPath.section)")
categoriacliccata = indexPath.section
print("row: \(indexPath.row)")
rowCliccata = indexPath.row
performSegue(withIdentifier: "segue_testo", sender: self)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if (segue.identifier == "segue_testo") {
let secondVC: TextView_Controller = segue.destination as! TextView_Controller
secondVC.recivedCategoria = categoriacliccata
secondVC.recivedRow = rowCliccata
}
}