Swift 4 и SwipeCellKit: попытка удалить строку 13 из раздела 0, который содержит только 13 строк перед обновлением - PullRequest
0 голосов
/ 07 сентября 2018

Я боролся с этим все утро после прочтения документации, просмотра учебника и поиска в Google. Могут ли свежие глаза заметить, что я делаю неправильно в этом расширении, чтобы получить

попытка удалить строку 13 из раздела 0, который содержит только 13 строк до обновления

//MARK: Swipe Cell Delegate Methods
extension TaskCardVC: SwipeTableViewCellDelegate {
    func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> [SwipeAction]? {

        if(orientation == .left)
        {
            let notInZone = SwipeAction(style: .default, title: "Not in Zone")
            {
                action, indexPath in
                print("Send Info to Backend and Remove")

                self.partsToLoad.remove(at: indexPath.row)
                action.fulfill(with: .delete)
                self.partsTableView.reloadData()
            }

            notInZone.image = UIImage(named: "not_in_zone_icon")

            return [notInZone]
        }
        else
        {
            let removeAction = SwipeAction(style: .destructive, title: "Removed")
            {
                action, indexPath in
                print("Send Info to Backend and Move part from Removals to Receivers")

                self.partsToLoad.remove(at: indexPath.row)
                action.fulfill(with: .delete)
                self.partsTableView.reloadData()
            }

            removeAction.image = UIImage(named: "remove_part_icon")

            return [removeAction]
        }

    }

    func tableView(_ tableView: UITableView, editActionsOptionsForRowAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> SwipeOptions {
        var options = SwipeOptions()
        options.expansionStyle = .destructive
        return options
    }
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...