---
title: Configuring Attributes
framework: coredata
role: article
role_heading: Article
path: coredata/configuring-attributes
---

# Configuring Attributes

Describe the properties that compose an entity.

## Overview

Overview After you create an entity as described in Configuring Entities, you can add attributes to that entity. An attribute describes a property of an entity. At minimum, you need to specify the property’s name and data type, whether it must be saved in the store, and whether it’s required to have a value when it’s saved. For some attribute types, you can also choose whether to use a scalar type to represent the attribute in generated classes, as well as configure the attribute to have a default value, or to apply data validation rules. Add Attributes Add an attribute as indicated in the screenshot and the steps that follow:

With an entity selected, click Add Attribute at the bottom of the editor area. A new attribute with the placeholder name attribute, of type Undefined, appears in the Attributes list. In the Attributes list, double-click the newly added attribute, and rename it. In the Attributes list, as shown in the second screenshot, click Undefined and choose the attribute’s data type from the Type pop-up menu.

Configure Attributes Use the data model inspector (choose View > Inspectors > Show Data Model Inspector) to configure attributes.

For the full list of types, see NSAttributeType. Core Data optionals aren’t the same as Swift optionals. You can use a Swift optional to represent a required attribute, for example, if you need flexibility to set its value during the time between the object’s initialization and its first save. Supplying a default value, in combination with making the type non-optional, can provide performance benefits. For the full list of types, including scalar variants, see NSAttributeType. For more information, see Core Spotlight. For more information, see Migrating your data model automatically.

## See Also

### Configuring a Core Data Model

- [Configuring Entities](coredata/configuring-entities.md)
- [Configuring Relationships](coredata/configuring-relationships.md)
- [Generating code](coredata/generating-code.md)
