WWDC24 SALE: Save 50% on all my Swift books and bundles! >>

Ultimate Portfolio: ProjectView swipe-to-delete bug

Forums > SwiftUI

I'm at step 13 in the course. I haven't noticed this behavior before but I don't think I've changed the deletion code from the earlier step, so I may just not have been aware of the issue.

When swiping a list item row in the list, the wrong row and item are deleted.

Please note in the screenshot that the index offset is the 0th item, and the current item in the onDelete function is item 7 in the list at index 1. However, the wrong-row deletion is not one off each time, it seems to be that random rows are deleted for a given swipe-to-delete action.

Any ideas? Has anyone else seen this?

screenshot

3      

I think Paul do address this in a later video, but it to do with the sort order

let allItems = project.projectItems(using: sortOrder)

3      

Yep, thanks for your answer, you're right. Paul introduces the bug fix in the next lesson.

3      

Save 50% in my WWDC sale.

SAVE 50% To celebrate WWDC24, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.