|
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 Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until February 9th.
Sponsor Hacking with Swift and reach the world's largest Swift community!
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.
Link copied to your pasteboard.