CoreStore icon indicating copy to clipboard operation
CoreStore copied to clipboard

How to creat a FetchedResultsController?

Open jshl8612 opened this issue 5 years ago • 2 comments

Would you like to tell me the right way to make a FetchedResultsController?

let fecthController = dataStack.createFetchedResultsController(From<Food>(), SectionBy<Food>("name"), OrderBy<Food>(.ascending("foodID")))

With above code, fetchedObjects is always nil.

jshl8612 avatar Apr 16 '19 08:04 jshl8612

Is there any reason you prefer NSFetchedResultsController instead of ListMonitor?

As for your question, there's nothing that looks wrong in your code so there must be some other problem. Are you seeing any error logs in the console?

JohnEstropia avatar Apr 16 '19 09:04 JohnEstropia

Is there any reason you prefer NSFetchedResultsController instead of ListMonitor?

As for your question, there's nothing that looks wrong in your code so there must be some other problem. Are you seeing any error logs in the console?

Because the ListMonitor<Food> couldn't set to ListMonitor<SuperClassOfFood>.

I have a BaseViewController contains NSFetchedResultsController to deal with most of the same job, and overriding the get function in subclass.

There was no error logs in console.

jshl8612 avatar Apr 17 '19 01:04 jshl8612