Class

NSDerivedAttributeDescription

A description of an attribute of a Core Data entity that derives its value from one or more other properties.

Declaration

@interface NSDerivedAttributeDescription : NSAttributeDescription

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.

Supported functions include canonical:, uppercase:, and lowercase:.

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.

Supported functions include @count and @sum.

friends.@count

time

The current time.

now()

Topics

Specifying the Derivation Expression

derivationExpression

An expression for generating derived data.

Relationships

See Also

Attributes and Relationships

NSPropertyDescription

A description of a property of a Core Data entity.

NSAttributeDescription

A description of an attribute of a Core Data entity.

NSAttributeType

The possible types of Core Data attributes.

NSRelationshipDescription

A description of a relationship of a Core Data entity.