I am working on a todo list app and whenever I run it on the simulator and try to print the items in my array, the other cells item get printed.
simulator
array
You need didSelectRowAt not didDeselectRowAt , the latter is triggered when you select a row so you get the print from the previous selected row
didSelectRowAt
didDeselectRowAt
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { print(itemArray[indexPath.row]) }