Deleting a Row (pg 168) Not Completing

I completed the Chapter 10 code to delete a row in the Homepwnr App, but when I go into edit mode and click on the delete icon, it only activates the slide to delete button, but doesn’t actually delete the row. If I then click on the delete box, it does delete the row, so I know the delete code is working accurately. Here is what the screen initially looks like when I click on the delete circle icon:

I found the following Stackoverflow post (delete with edit button) that indicated I needed the following additional code in order to use the delete button while in edit mode:

override func tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle {
        if (self.tableView.editing) {
            return UITableViewCellEditingStyle.Delete
        }
        return UITableViewCellEditingStyle.None
}

I added this code, but it still does not delete when I hit the circle delete button. It just slides to the left to reveal the delete box (which does work).

Any suggestions?

when I go into edit mode and click on the delete icon, it only activates the slide to delete button, but doesn’t actually delete the row. If I then click on the delete box, it does delete the row

slide to delete =

  1. Do not hit Edit button

  2. Click on a row, hold the mouse button down, and slide to the left.

  3. A Delete button will be revealed just as if you had:
    a. Clicked Edit button
    b. Clicked Minus Sign button

  4. Click on the Delete button to remove the row.

The code you posted disables slide to delete in that swiping left will never reveal the Delete button.

Oops. I realize now that I just didn’t understand the way that particular delete function worked with iPhones. I thought when you go into edit mode and click the circle with the minus sign that the row gets deleted at that point. But now I see that it just reveals the slide to delete button. I feel like I should delete this question so as not to confuse anyone else with my misunderstanding.

Anyway, thanks for your help.

Yep. I guess that says something about Apple’s UI.