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

# NSDerivedAttributeDescription

A description of an attribute that derives its value by performing a calculation on a related attribute.

```
class NSDerivedAttributeDescription
```

## Overview

Use derived attributes to optimize fetch performance; for example:

- Create a derived `searchName` attribute to reflect a `name` attribute with case and diacritics removed for more efficient comparison.
- Create a derived `relationshipCount` attribute to reflect the number of objects in a relationship and avoid having to do a join.

Derived attributes support the following expressions:

|**Expression**                 |**Description**                                                                                                                                                                                                                        |**Example**            |
|-------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------|
|to-one keypath                 |A single value to replicate.                                                                                                                                                                                                           |`name` or `author.name`|
|to-one keypath with a function |The result of calling a function on a single value. ![](spacer) Supported functions include `canonical:`, `uppercase:`, and `lowercase:`. ![](spacer) The `canonical:` function returns a case- and diacritic-insensitive String value.|`canonical:(name)`     |
|to-many keypath with a function|The result of calling an aggregate function on a set of values. ![](spacer) Supported functions include `@count` and `@sum`.                                                                                                           |`friends.@count`       |
|time                           |The current time.                                                                                                                                                                                                                      |`now()`                |

> Important:
> Data recomputes derived attributes when you save a context. A managed object’s property does not reflect unsaved changes until you save the context and refresh the object.

## Topics

### Specifying the Derivation Expression

[`derivationExpression`](/documentation/CoreData/NSDerivedAttributeDescription/derivationExpression)

An expression for generating derived data.



---

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)