Apologies
You must be signed in to watch this lesson.
Swipe Delete and Reload Items
Contacts DiffableDataSource
In this lesson, let's go ahead and implement swipe actions to handle favoriting and also deleting objects from our UITableView. There are some tricky aspects to getting this fully functional so let's walk through it together.

Comments (2)
donmcallister
3 years ago
I found a solution to keep the Contact as a struct: struct Contact: Hashable { let id: UUID = UUID() let name: String var isFavorite = false func hash(into hasher: inout Hasher) { hasher.combine(id) } static func == (lhs: Contact, rhs: Contact) -> Bool { return lhs.id == rhs.id } } *cell to update: use viewModel instead of contact: cell.viewModel.isFavorite = self.viewModel.isFavorite *and toggle the viewModel bool state instead in favoriteAction. toggle on contact.isFavorite doesn't work: self.viewModel.isFavorite.toggle()
donmcallister
3 years ago
it was on slide 30: https://developer.apple.com/videos/play/wwdc2019/220
HELP & SUPPORT