1

Is there an API to fetch data in chunks from DB and display (like a progress) in UI. Vice-vera , can we do the same for saving ?

Abhishek Bedi
  • 5,205
  • 2
  • 36
  • 62

1 Answers1

1

After reading some articles on Core Data API, i am able to achieve an asynchronous fetching behavior.

@Adam Fallon, you were correct when you said the without knowing the size of the content to be fetched, we cannot define the progress. But for fetching file size , we can simply call:

managedObjectContext.count(for: fetch).

And for incremental fetching, we can use NSAsynchronousFetchRequest API.

Sample Code: Core-Data-Asynchronous-Fetching

Blog link: Core-Data-Asynchronous-Fetching

Video Link: Core-Data-Asynchronous-Fetching

Will be exploring more for incremental saving.

Abhishek Bedi
  • 5,205
  • 2
  • 36
  • 62
  • Hi, I have tried to run your github sample. However, if `-com.apple.CoreData.ConcurrencyDebug 1` flag is enabled, it will have fatal crash. Do you know why? Here's the detailed - https://stackoverflow.com/questions/70538970/why-i-am-getting-multithreading-violation-allthatislefttousishonor-for-this-simp Thank you – Cheok Yan Cheng Dec 31 '21 at 16:53