Chapter 6. Modeling Data in Xcode

WHAT'S IN THIS CHAPTER?

  • Defining entities and their attributes

  • Expressing the relationships between entities

  • Creating fetched properties and fetch requests using the predicate builder

  • Generating custom subclasses of NSManagedObject from your model

In the previous chapter, you learned the fundamentals of working with Core Data. In this chapter, you explore the Xcode Data Modeling tool and learn how to create data models graphically.

In this chapter, you learn how to use the Xcode Data Modeling tool to graphically create your Core Data model. The tool is easy to use and can dramatically speed the development time of your next data-driven application. Think of the Data Modeling tool as Interface Builder for your data.

You can use the tool to model the entities and attributes that you will use in your application. You can also use the tool to define relationships between entities, create fetched properties, and even build fetch requests.

MODELING YOUR DATA

In Chapter 2, you learned about the importance of modeling your data before you begin work on your application. I showed you how I use Omni Graffle to create my Entity-Relationship Diagrams. Then, you explored how to turn those diagrams into an SQLite database. In this chapter, you learn how to use the Xcode Modeling tool to model your data and turn the model into Core Data objects.

The Xcode Modeling tool uses a multi-pane interface, as shown in Figure 6-1. There are three panes at the top of the tool. They ...

Get Professional iPhone® and iPad™ Database Application Programming 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.