|
struct OneToManyCandyView: View { @Environment(.managedObjectContext) var moc @FetchRequest(sortDescriptors: []) var countries: FetchedResults<Country>
} |
|
hi mrad, to delete from the sectioned list by swiping, attach this
and then add the function
hope that helps, DMG |
|
|
|
Hi @delawaremathguy, I know this is many months later but I am asking in hopes that you might see this and help me. I've been trying to take your solution above and adapt it to work with a
The problem I have been running into is trying to figure out how to get the So how could I find the Thanks |
|
The .onTapGesture should provide the candy entity for the row tapped. Offsets are provided by the .onDelete modifier and aren't available/provided by .onTapGesture. I think - but haven't verfied - adding this to the .onTapGesture should do the trick... moc.delete(candy) try? moc.save() |
|
Sadly this won't work, and its because the data of the ForEach loop is coming from
|
|
So I have created a janky modified func from Chat-GPT which creates an somewhat solution and I am not entirely confident its actually deleteing anything.
It will "delete" and save but there is no animation and I honestly believe there has to be a more elegant way that will make swiftui more happy Edit: I have got the animation to work and that is by using |
SPONSORED Still waiting on your CI build? Speed it up ~3x with Blaze - change one line, pay less, keep your existing GitHub workflows. First 25 HWS readers to use code HACKING at checkout get 50% off the first year. Try it now for free!
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.