I'm trying to learn how to use Core Data and I have a few sub-views that I want to pass the collection of items from Core Data through but I can't get it to work and the error messages make no sense to me.
This is what I have in my (main) ContentView:
@FetchRequest(sortDescriptors: [NSSortDescriptor(keyPath: \Item.firstName, ascending: true)]) var people: FetchedResults<Item>
I then have the following code in my call to the sub-view:
PeopleListView(people: people)
Inside the PeopleListView I have this to try and bind the variable.
@Binding var people: FetchedResults<Item>
The error I'm getting is the call to the sub view which is this:
Cannot convert value of type 'FetchedResults<Item>' to expected argument type 'Binding<FetchedResults<Item>>'
Can someone explain this in really simple terms on why this isn't working and how I can fix it? I'm really struggling with Core Data, I feel like there's so much going on behind the scenes that I just don't understand.