I've encountered very odd behaviour with two delegate methods
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
print("will display \(indexPath.section) - \(indexPath.row)")
addInputRules(tableView, cell, indexPath)
}
func tableView(_ tableView: UITableView, didEndDisplaying cell: UITableViewCell, forRowAt indexPath: IndexPath) {
print("did end display \(indexPath.section) - \(indexPath.row)")
removeInputRules(tableView, cell, indexPath)
}
I am adding and removing input validation rules to table view cells while scrolling. It works perfectly. But when I do section reload with
tableView.reloadSections(IndexSet([indexPath.section]), with: .automatic)
There are willDisplay and didEndDisplaying delegate methods called but in inappropriate order!
There is willDisplay and after it didEndDisplaying
will display 0 - 0
will display 0 - 1
will display 0 - 2
will display 0 - 3
will display 0 - 4
will display 0 - 5
did end display 0 - 0
did end display 0 - 1
did end display 0 - 2
did end display 0 - 3
did end display 0 - 4
did end display 0 - 5
did end display 0 - 0
did end display 0 - 1
did end display 0 - 2
did end display 0 - 3
did end display 0 - 4
did end display 0 - 5
What is causing my validation rules to be removed!