iOS Development

Core Data

Michael L. Collard, Ph.D.

Department of Computer Science, The University of Akron


  • All apps have them
  • Major part of development
  • Multiple issues


  • How is the data stored?
  • How do we get access to it?
  • Localization
  • Order
  • Schema
  • How easy is it to prevent mistakes in the data
    • field names
    • data value
  • What about default data?
  • Can we support undo/redo?
  • What is the scalability of the data?
  • What happens when we have to change the data stored?


  • Stored as single file
  • Must manage place, e.g., bundled or in documents
  • Stored as dictionary in memory
  • Easy to make mistakes in field names
  • Unable to update just one part (all or nothing)


  • Direct access vs. abstraction
  • Many customizable steps vs. few direct steps
  • Developer knowledge
  • Ability to optimize parts that need optimization

Core Data Features

  • Change tracking and undo
  • Memory efficiencies
    • Partially materialized futures
    • copy-on-write sharing
  • Validation of values
  • Schema migration
  • Automated property handling
  • Grouping and filtering
  • Query compilation
  • Merge policies

Data Model

  • schema parts and structure of the data source
  • entities kind of items in our schema, viewed as classes
  • attributes characteristic of an entity, with name and type, viewed as object properties

Persistence Stores

  • SQLite
  • Binary files
  • In-Memory

How do I?

  • Create the schema?
  • Load the data source?
  • Access the data?
  • Store the data into the data source?

Creating the Schema

  • Create using the Core Data Model Editor
  • Schema stored in .xcdatamodel file