If you are not going to use the tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) view selection function tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) do not use tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) . I know I always used this as a didTapOnRowAt method, but it would be better to use willSelectRowAt :
func tableView(_ tableView: UITableView, willSelectRowAt indexPath: IndexPath) -> IndexPath? { // code for when a row is tapped return nil }
return nil means that the cell will not actually be selected.
source share