Earthquakes: Populating a Core Data Store Using a Background Queue
Version 1.6, 2017-03-23
Upgraded to Swift 3.0
(Full Revision History)
macOS 10.12 SDK or later
Earthquakes demonstrates how to set up a Core Data stack with NSPersistentContainer and use a private-queue context to import a bunch of data retrieved from a remote server. NSFetchedResultsController, which is newly avaiable on macOS 10.12 but extensively adopted on iOS, is used as the data source of NSTableView. How to do batch deletes with NSBatchDeleteRequest is also covered in this sample.