<!--
{
  "documentType" : "article",
  "framework" : "CoreData",
  "identifier" : "/documentation/CoreData/creating-a-core-data-model",
  "metadataVersion" : "0.1.0",
  "role" : "article",
  "title" : "Creating a Core Data model"
}
-->

# Creating a Core Data model

Define your app’s object structure with a data model file.

## Discussion

The first step in working with Core Data is to create a data model file to define the structure of your app’s objects, including their object types, properties, and relationships.

You can add a Core Data model file to your Xcode project when you create the project, or you can add it to an existing project.

### Add Core Data to a New Xcode Project

In the dialog for creating a new project, select the Use Core Data checkbox, and click Next.

![Screenshot showing the Use Core Data checkbox in the options for creating a new Xcode project. The checkbox appears after the language dropdown, and before the checkboxes for including Unit Tests and UI Tests.](images/com.apple.coredata/media-3039511@2x.png)

The resulting project includes an `.xcdatamodeld` file.

![Screenshot showing the .xcdatamodeld file highlighted in the project navigator.](images/com.apple.coredata/media-3080773@2x.png)

### Add a Core Data Model to an Existing Project

Choose File > New > File and select the iOS platform tab. Scroll down to the Core Data section, select Data Model, and click Next.

![Screenshot showing the Data Model template in the Core Data section of the file template chooser.](images/com.apple.coredata/media-3039513@2x.png)

Name your model file, select its group and targets, and click Create.

![Screenshot showing the dialog for saving a data model file. The filename is selected and immediately editable.](images/com.apple.coredata/media-3122943@2x.png)

Xcode adds an `.xcdatamodeld` file with the specified name to your project.

![Screenshot of Xcode showing the new model file selected in the project navigator.](images/com.apple.coredata/media-3080772@2x.png)

## See Also

[Configuring Attributes](/documentation/CoreData/configuring-attributes)

Describe the properties that compose an entity.

[Configuring Relationships](/documentation/CoreData/configuring-relationships)

Specify how entities relate and how change propagates between them.

[Generating code](/documentation/CoreData/generating-code)

Automatically or manually generate managed object subclasses from entities.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)