I'm trying to create an CoreData
Entity
observer:
@FetchRequest(sortDescriptors: []) var todoResult: FetchedResults<Todo>
init() {
todoResult.publisher.sink { _ in
print("sink")
} receiveValue: { todos in
print("recoved todos")
}.store(in: &cancellables)
}
But I'm getting this error:
Accessing StateObject's object without being installed on a View. This will create a new instance each time.
Any of you knows why I'm getting this error since I'm not creating this instance in a model? or if you know a work around this error. I'll really appreciated.