Entity Inheritance

Similar to classes, entities have the ability to inherit from a parent. This useful feature allows you to simplify the data model. Child entities automatically inherit the attributes of their parent entity. In an underlying SQLite store, all entities involved in a parent-child hierarchy reside in the same table.

The sample application is centered on the understanding that grocery items could live in one of two locations: the shop or your house. This means entity inheritance could be leveraged to allow attributes common to a shop location and home location to be inherited from a parent location. For example, let’s say an entity called Location has an attribute called summary. If another entity such as LocationAtHome or LocationAtShop ...

Get Learning Core Data for iOS: A Hands-On Guide to Building Core Data Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.