I’m working in the edit items chapter and i’ve been struggling with this code how the method firstIndex(of:) can find the item that i passed back didn’t i change it’s text? what is it comparing to exactly? it should be like a new item and this method should return nil?
func addItemViewController(_ controller: AddItemViewController, didFinishEditing item: ChecklistItem) {
if let index = items.firstIndex(of: item) {
let indexPath = IndexPath(row: index, section: 0)
if let cell = tableView.cellForRow(at: indexPath) {
configureText(for: cell, with: item)
}
}
navigationController?.popViewController(animated: true)
}