The core data User I create with property id and name, which I want to fetch it into list.
struct MyView: View {
@FetchRequest(entity: User.entity(), sortDescriptors: []) var users: FetchedResults<User>
var body: some View {
VStack {
List {
ForEach(users, id: \.id) { user in // Type '_' has no member 'id'
// Text(user.name)
}
}
}
}
}
I'm confused with the error report seems it is not successfully import core data entity.
UPDATE
When I try to use the name property in list, it also report Value of type 'NSManagedObject' has no member 'name' error message.
ForEach(users, id: \.id) { user in
Text(user.name)
}
