Earthquakes: Populating a Core Data Store Using a Background Queue
Version 2.0, 2018-05-03
Added iOS support. Upgraded to Swift 4.
(Full Revision History)
macOS 10.13 SDK or later; iOS 11 SDK or later.
macOS 10.13; iOS 11
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 the table view. How to do batch deletes with NSBatchDeleteRequest is also covered in this sample.