Efficient Core Data handling using NSTableView with around 500.000 records

620 views Asked by At

Good morning guys, I developed an iOS app using Core Data and the TICoreDataSync library (http://timisted.github.io/TICoreDataSync/) to sync between devices, now I would like to create a similar Mac OSX app to sync with the iOS one and I'm looking around the web how to efficiently handle data because I have around 500.000 records. On iOS I used the NSFetchedResultsController to efficiently manage the results returned from a Core Data fetch request to provide data for a UITableView object, but on Mac OSX the NSFetchedResultsController is unavailable, so I read alternatives here:

http://youtu.be/NpDQDjFJ_5Y

How to handle extremely large CoreData store in NSTableView?

NSArrayController without loading a large dataset into an array

But reading the comments it seems that someone consider these ways still laggy. What do you suggest me to do? Thanks a lot in advance.

1

There are 1 answers

1
Aneesh Dangayach On

You can use Core Data incremental Store to sync data to you Mac OSX in background.

https://developer.apple.com/library/ios/documentation/DataManagement/Conceptual/IncrementalStorePG/Introduction/Introduction.html

To load data on your table view, you can use delegate source method to fetch the data in batches from the local core data store use

- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row;

Or else if you don't want to use Core Data Incremental Store(it will be tough to use), then in the delegate method, call the service to get your data and show it on the UI. We have successfully tested and handled this for around 200000+ records.