BLACK FRIDAY: Save 50% on all my Swift books and bundles! >>

SOLVED: Ultimate Portfolio App - deleteAll doesn't delete?

Forums > Articles

After calling deleteAll() and creating a new dataset, old data is still visible in the ProjectsView. At least for me! Is this expected, is the View holding on to some cached data?

7      

Same question here. Hitting "add" several time should to my understanding delete all projects/ items and create 5 new projects. However old data keeps staying.

5      

Well I really don't know what went wrong here, but editing the Add Data button in HomeView and rebuilding made it work as expected. Weird.

5      

Save 50% in my WWDC sale.

SAVE 50% All our books and bundles are half price for Black Friday, 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!

Could you kindly let me know what you edited exactly on the Button?

5      

I tested to add a new button doing only the delete, and it worked fine. Then I undid my edit, back to the original, and it still worked. I really can't figure out what happened. 🤷

5      

Looks like we need a call to dataController.save() in HomeView after the call to dataController.deleteAll(). Look at this tweet.

https://twitter.com/MrGLWatson/status/1320448229914353666

5      

Well done @TwoFortyTwoApps

Here

Button("Add Data") {
    dataController.deleteAll()
    dataController.save()
    try? dataController.createSampleData()
}

5      

This is still not updating until I restart the app even after doing

Button("Add Data") {
    dataController.deleteAll()
    dataController.save()
    try? dataController.createSampleData()
}

5      

5      

Save 50% in my WWDC sale.

SAVE 50% All our books and bundles are half price for Black Friday, 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.