|
Hello! I successfully made a generic fetchRequest like Paul is showing in Dynamically filtering @FetchRequest with SwiftUI - CoreData SwiftUI Tutorial 6/7. All is working absolute fine but i cannot implement the .onDelete modifier. Does anyone have a solution for that? Please find my code below. Thanks a lot in advance! Martin My FetchRequest View:
My Content View:
|
|
I guess your .onDelete should be added on the list i.e.
Or try like this..
the deleteBooks func should be in the struct FetchedListView and as below:
You should add also the below in the FetchedList View file
Give it a try.. |
|
...thanks @Bnerd, unfortunatly it's not working. I triggers following error: Value of type 'Content' has no member 'onDelete' or Value of type 'List<Never, ForEach<FetchedResults<T>, Fetchedesults<T>.Element Content>>' (aka 'List<Never, ForEach<FetchedResults<T>, T, Content>>') has no member 'onDelete' |
|
Ok change it to the below:
|
|
Dearest @Bnerd, you are a star! thanks a lot, all is working now! and i learned a lot! Regards, Martin |
TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!
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.