Reference to row on table view of current table view cell

Is there a way for a table view cell to get a reference to the row it is currently on in the table view?

You can pass it in when you create the cell from the func tableView(UITableView, cellForRowAt: IndexPath) method.

Make a property on your cell for the row, and set it to indexPath.row

1 Like

Check out the following method.
func indexPath(for cell: UITableViewCell) -> IndexPath?

More info available here.

someting like RefreshTableView in Swift 3 Xcode 8 - YouTube ?

That’s a good idea. It’s amazing what other people think of that I don’t think of myself. Thank you.

This topic was automatically closed after 166 days. New replies are no longer allowed.