Need help with understanding how to use prepareForReuse() in UIKit. The documentation says
you should only reset attributes of the cell that are not
As stated by the documentation you only have to use the said method to reset attributes that are not related to the content. As for reseting the text/number of lines.... of your labels you could do it from within tableView(_:cellForRowAt:) just before you set their new value, like so:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
cell.label.text = "" //reseting the text
cell.label.text = "New value"
return cell
}
OR
you could take a more object oriented approach and create a subclass of UITableViewCell and define a method say configureCell() to deal with all the resetting and value setting of newly dequeued cells.