<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "swift: 5.9.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftData",
  "identifier" : "/documentation/SwiftData/Schema/CompositeAttribute",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "SwiftData"
    ],
    "preciseIdentifier" : "s:9SwiftData6SchemaC18CompositeAttributeC"
  },
  "title" : "Schema.CompositeAttribute"
}
-->

# Schema.CompositeAttribute

An object that describes an attribute that derives its value by composing other attributes.

```
final class CompositeAttribute
```

## Topics

### Creating a composite attribute

[`init(name:originalName:options:valueType:defaultValue:hashModifier:)`](/documentation/SwiftData/Schema/CompositeAttribute/init(name:originalName:options:valueType:defaultValue:hashModifier:))

### Composing attributes

[`properties`](/documentation/SwiftData/Schema/CompositeAttribute/properties)

### Encoding and decoding

[`encode(to:)`](/documentation/SwiftData/Schema/CompositeAttribute/encode(to:))

Encodes this value into the given encoder.

[`init(from:)`](/documentation/SwiftData/Schema/CompositeAttribute/init(from:))

### Debugging

[`debugDescription`](/documentation/SwiftData/Schema/CompositeAttribute/debugDescription)

A textual representation of this instance, suitable for debugging.

## Relationships

### Conforms To

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

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

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

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

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

[`SchemaProperty`](/documentation/SwiftData/SchemaProperty)

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

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

### Inherits From

[`Attribute`](/documentation/SwiftData/Schema/Attribute)

---

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)