<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "USDKit",
  "identifier" : "/documentation/USDKit/USDPrim/Attribute/Spec",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "USDKit"
    ],
    "preciseIdentifier" : "s:6USDKit7USDPrimV9AttributeV4SpecV"
  },
  "title" : "USDPrim.Attribute.Spec"
}
-->

# USDPrim.Attribute.Spec

A handle to an attribute definition stored in a layer.

```
struct Spec
```

## Overview

`USDPrim.Attribute.Spec` is a struct but acts as a handle into data
owned by a [`USDLayer`](/documentation/USDKit/USDLayer). Mutations write through to the layer.

## Topics

### Initializers

[`init()`](/documentation/USDKit/USDPrim/Attribute/Spec/init())

Creates an empty (invalid) attribute spec handle.

[`init?(USDLayer.Spec)`](/documentation/USDKit/USDPrim/Attribute/Spec/init(_:))

Narrows an untyped [`USDLayer.Spec`](/documentation/USDKit/USDLayer/Spec) to an attribute spec.

[`init?(layer: USDLayer, attributePath: USDLayer.Path, typeName: USDPrim.Attribute.ValueType, variability: USDPrim.Property.Variability, isCustom: Bool)`](/documentation/USDKit/USDPrim/Attribute/Spec/init(layer:attributePath:typeName:variability:isCustom:))

Creates an attribute spec at the given path in the layer, authoring
intermediate ancestor prim specs as `over`s where needed.

[`init?(owner: USDPrim.Spec, name: USDToken, typeName: USDPrim.Attribute.ValueType, variability: USDPrim.Property.Variability, isCustom: Bool)`](/documentation/USDKit/USDPrim/Attribute/Spec/init(owner:name:typeName:variability:isCustom:))

Creates a new attribute spec under the given prim spec.

### Instance Properties

[`var colorSpace: USDToken?`](/documentation/USDKit/USDPrim/Attribute/Spec/colorSpace)

The authored color space, or `nil` if not authored.
Assigning `nil` clears the color space.

[`var comment: String?`](/documentation/USDKit/USDPrim/Attribute/Spec/comment)

The authored user comment, or `nil` if not authored.

[`var connectionPaths: [USDLayer.Path]?`](/documentation/USDKit/USDPrim/Attribute/Spec/connectionPaths)

The authored connection paths, or `nil` if none authored.

[`var customData: Dictionary<String, USDValue>`](/documentation/USDKit/USDPrim/Attribute/Spec/customData)

The custom data dictionary authored on this attribute.

[`var documentation: String?`](/documentation/USDKit/USDPrim/Attribute/Spec/documentation)

The authored documentation, or `nil` if not authored.

[`var isCustom: Bool`](/documentation/USDKit/USDPrim/Attribute/Spec/isCustom)

Whether this attribute was authored as `custom`.

[`var name: USDToken`](/documentation/USDKit/USDPrim/Attribute/Spec/name)

The attribute’s local name.

[`var owner: USDLayer.Spec?`](/documentation/USDKit/USDPrim/Attribute/Spec/owner)

The spec that contains this attribute.

[`var permission: USDLayer.Permission`](/documentation/USDKit/USDPrim/Attribute/Spec/permission)

The attribute’s permission level (public, restricted, private).

### Instance Methods

[`func clearAssetInfo(String)`](/documentation/USDKit/USDPrim/Attribute/Spec/clearAssetInfo(_:))

Removes `key` from the asset info dictionary.

[`func clearConnectionPaths()`](/documentation/USDKit/USDPrim/Attribute/Spec/clearConnectionPaths())

Clears all authored connection paths on this attribute.

[`func clearCustomData(String)`](/documentation/USDKit/USDPrim/Attribute/Spec/clearCustomData(_:))

Removes `key` from the custom data dictionary.

[`func rename(to: USDToken) throws`](/documentation/USDKit/USDPrim/Attribute/Spec/rename(to:))

Sets the attribute’s name.

[`func setAssetInfo(String, to: USDValue)`](/documentation/USDKit/USDPrim/Attribute/Spec/setAssetInfo(_:to:))

Sets `key` in the asset info dictionary to `value`. Read the
full dictionary via `field("assetInfo")` from FieldCollection.

[`func setCustomData(String, to: USDValue)`](/documentation/USDKit/USDPrim/Attribute/Spec/setCustomData(_:to:))

Sets `key` in the custom data dictionary to `value`.

## Relationships

### Conforms To

[`MetadataCollection`](/documentation/USDKit/USDLayer/Spec/MetadataCollection)

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

[`FieldCollection`](/documentation/USDKit/USDLayer/Spec/FieldCollection)

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

[`SymmetryCollection`](/documentation/USDKit/USDPrim/Property/Spec/SymmetryCollection)

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

[`ValueCollection`](/documentation/USDKit/USDPrim/Property/Spec/ValueCollection)

---

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)