I have a common UITableView and I want to go through every visible cell.
How to do it fast?
I am currently using this in one of my projects:
let cells = self.tableView.visibleCells as! Array<UITableViewCell> for cell in cells { // look at data }
Here is another answer, but it is in objective-C: How can I iterate over UITableView cells?
You can not. UITableView does not save cells that are not visible. As soon as the cell is completely moved off the screen, it is deleted and added to the reuse queue.
, . , . cellForRowAtIndex .
cellForRowAtIndexPath
. . , .
let table = UITableView() for cell in table.visibleCells() { print(cell) }
[. , . , , , , .]
"", , .
( , ), , .
, , cellForRowAtIndexPath time; , , .