I have a table view with a bunch of different sections and dynamic number of rows in each section. In the very first section I have a cell to 'select all'. Is there a quick and easy way to manually select all the cells, so the code in their didSelect
triggers and next time the user presses one of the cells it triggers their didDeselect
? The only way I can think of right now is to loop through all the sections, and in each section loop through 0 < indexPath.row < section's data array count
and call
self.tableView.selectRow(at: indexPath, animated: false, scrollPosition: UITableViewScrollPosition.none)
self.tableView(self.tableView, didSelectRowAt: indexPath)
but is there a way to do it without so much looping?