<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSClassDescription/inverse(forRelationshipKey:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSClassDescription(im)inverseForRelationshipKey:"
  },
  "title" : "inverse(forRelationshipKey:)"
}
-->

# inverse(forRelationshipKey:)

Overridden by subclasses to return the name of the inverse relationship from a relationship specified by a given key.

```
func inverse(forRelationshipKey relationshipKey: String) -> String?
```

## Return Value

The name of the inverse relationship from the relationship specified by `relationshipKey`.

## Discussion

For a given key that defines the name of the relationship from the receiver’s class to another class, returns the name of the relationship from the other class to the receiver’s class. For example, suppose an Employee class has a relationship named `department` to a Department class, and that Department has a relationship named `employees` to Employee. The statement:

```objc
[employee inverseForRelationshipKey:@"department"];
```

returns the string `employees`.

If you have an instance of the class the receiver describes, you can use the `NSObject` instance method <doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class/inverse(forRelationshipKey:)> instead.

---

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)