Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Although Core Data is a descendant of Apple's <a href="http://en.wikipedia.org/wiki/Enterprise_Objects_Framework" rel="noreferrer">Enterprise Object Framework</a>, an object-relational mapper (ORM) that was/is tightly tied to a relational backend, Core Data is <em>not</em> an ORM. It is, in fact, an object graph management framework. It manages a potentially very large graph of object instances, allowing an app to work with a graph that would not entirely fit into memory by faulting objects in and out of memory as necessary. Core Data also manages constraints on properties and relationships and maintains reference integrity (e.g. keeping forward and backward links consistent when objects are added/removed to/from a relationship). Core Data is thus an ideal framework for building the "model" component of an MVC architecture.</p> <p>To implement its graph management, Core Data <em>happens</em> to use SQLite as a disk store. It <em>could</em> have been implemented using a different relational database or even a non-relational database such as <a href="http://couchdb.apache.org/" rel="noreferrer">CouchDB</a>. As others have pointed out, Core Data can also use XML or a binary format or a user-written atomic format as a backend (though these options require that the entire object graph fit into memory). If you're interested in how Core Data is implemented on an SQLite backend, you might want to check out OmniGroup's <a href="http://www.omnigroup.com/developer/" rel="noreferrer">OmniDataObjects</a> framework, an open source implementation of a subset of the Core Data API. The <a href="http://basetenframework.org/" rel="noreferrer">BaseTen</a> framework is also an implementation of the Core Data API using PostgreSQL as a backend.</p> <p>Because Core Data is not intended to be an ORM for SQLite, it cannot read arbitrary SQLite schema. Conversely, you should not rely on being able to read Core Data's SQLite data stores with other SQLite tools; the schema is an implementation detail that may change.</p> <p>Thus, there is not really any conflict between using Core Data or SQLite directly. If you want a relational database, use SQLite (directly or via one of the Objective-C wrappers such as <a href="https://github.com/ccgus/fmdb" rel="noreferrer">FMDB</a>), or a relational database server. However, you may still want to learn Core Data for use as an object graph management framework. In combination with Apple's controller classes and key-value binding compatible view widgets, you can implement a complete MVC architecture with <em>very</em> little code.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload