<!--
{
  "availability" : [
    "iOS: 3.0.0 -",
    "iPadOS: 3.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.4.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreData",
  "identifier" : "/documentation/CoreData/NSRelationshipDescription",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Core Data"
    ],
    "preciseIdentifier" : "c:objc(cs)NSRelationshipDescription"
  },
  "title" : "NSRelationshipDescription"
}
-->

# NSRelationshipDescription

A description of a relationship between two entities.

```
class NSRelationshipDescription
```

## Overview

[`NSRelationshipDescription`](/documentation/CoreData/NSRelationshipDescription) provides additional attributes that are specific to modeling a relationship between two entities. For the common attributes of all property types, see [`NSPropertyDescription`](/documentation/CoreData/NSPropertyDescription).

For example, use this class to define a relationship’s *cardinality* — the number of managed objects the relationship can reference.

- For a to-one relationship, set [`maxCount`](/documentation/CoreData/NSRelationshipDescription/maxCount) to `1`.
- For a to-many relationship, set [`maxCount`](/documentation/CoreData/NSRelationshipDescription/maxCount) to a number greater than `1` to impose an upper limit; otherwise, use `0` to allow an unlimited number of referenced objects.

At runtime, you can modify a relationship description until you associate its owning managed object model with a persistent store coordinator.  If you attempt to modify the model after you associate it, Core Data throws an exception. To modify a model that’s in use, create and modify a copy and then discard any objects that belong to the original model.

## Topics

### Configuring the Destination

[`inverseRelationship`](/documentation/CoreData/NSRelationshipDescription/inverseRelationship)

The relationship that represents the inverse of the current relationship.

[`destinationEntity`](/documentation/CoreData/NSRelationshipDescription/destinationEntity)

The type of object the relationship contains.

[`ordered`](/documentation/CoreData/NSRelationshipDescription/isOrdered)

A Boolean value that determines whether the relationship preserves the order of the referenced managed objects.

### Configuring Cardinality

[`toMany`](/documentation/CoreData/NSRelationshipDescription/isToMany)

Returns a Boolean value that indicates whether the relationship can contain many managed objects.

[`minCount`](/documentation/CoreData/NSRelationshipDescription/minCount)

The minimum number of managed objects the relationship can reference.

[`maxCount`](/documentation/CoreData/NSRelationshipDescription/maxCount)

The maximum number of managed objects the relationship can reference.

### Configuring Delete Behavior

[`deleteRule`](/documentation/CoreData/NSRelationshipDescription/deleteRule)

The rule to apply when you delete the relationship’s owning managed object.

[`NSDeleteRule`](/documentation/CoreData/NSDeleteRule)

Constants that determine what happens when you delete a relationship’s owning managed object.

### Getting Version Data

[`versionHash`](/documentation/CoreData/NSRelationshipDescription/versionHash)

The relationship’s unique identity.

## Relationships

### Inherits From

[`NSPropertyDescription`](/documentation/CoreData/NSPropertyDescription)

### Conforms To

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Hashable`](/documentation/Swift/Hashable)

---

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)