Key Concepts: Core Data
CoreData has been known to make grown adults cry.
CoreData makes persisting and managing large amounts of data in your application easy (or more truthfully: easier). Some of the most powerful and useful features of CoreData are that it allows you to sort and filter large amounts of data based on textual queries: just like a database.
There is a great deal of boilerplate code when using CoreData. We recommend always creating CoreData projects via the Master/Detail or Blank Xcode templates.
Generally you can ignore all the boilerplate, except for the managedObjectContext. The managedObjectContext (or moc) is your interface to CoreData.
CoreData maps the underlying data onto NSManagedObjects. You structure your database in the xcdatamodeld file in Xcode. Add Entities to the data model, these are your classes. Add attributes, these are your properties.
Fetch from CoreData using NSFetchRequests. You can configure the fetch request with further sorting and filtering criteria before asking your managedObjectContext to execute the query, thus returning an array of CoreData NSManagedObjects.
Typically you then map that array onto a UITableView as we have learned previously.
When adding new objects to your CoreData database we use [NSEntityDescription insertNewObjectForEntity:inManagedObjectContext] then set its properties. Don't forget to call save on your moc!