Я пытаюсь удалить строку из UITableView с помощью функции trailingSwipeActionsConfigurationForRowAt. * 1001 *
Строка удаляется и исчезает.С этой частью все в порядке.
Но следующие строки, которые появляются на экране или когда я проведу вниз столько же, сколько были удалены строки, даже не загружаются в tableView.
! [Img1] https://poirot.deus4.com/photo_2019-06-12_16-44-01.jpg
! [Img2] https://poirot.deus4.com/photo_2019-06-12_16-43-56.jpg
! [Img3] https://poirot.deus4.com/photo_2019-06-12_16-43-49.jpg
! [Img4] https://poirot.deus4.com/photo_2019-06-12_16-43-38.jpg
[видео] https://poirot.deus4.com/RPReplay_Final1560345600.mp4
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return filteredProducts.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: .cellID, for: indexPath) as! ProductTableCell
cell.backgroundColor = .red
return cell
}
override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let hide = UIContextualAction(style: .destructive, title: "Hide") { action, view, completion in
self.filteredProducts.remove(at: indexPath.row)
tableView.deleteRows(at: [indexPath], with: .automatic)
completion(true)
}
hide.image = #imageLiteral(resourceName: "hdie_product")
hide.backgroundColor = .midGrey
let conf = UISwipeActionsConfiguration(actions: [hide])
return conf
}