<!--
{
  "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/USDValue",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "USDKit"
    ],
    "preciseIdentifier" : "s:6USDKit8USDValueV"
  },
  "title" : "USDValue"
}
-->

# USDValue

A type-erased container for a value stored in a Universal Scene Description
file.

```
struct USDValue
```

## Overview

`USDValue` wraps the various concrete value types USD recognises (numerics,
strings, vectors, tokens, paths, asset paths, time codes, and so on) so they
can be passed through generic APIs without exposing the underlying C++
representation.

## Topics

### Creating a value

[`init()`](/documentation/USDKit/USDValue/init())

Creates an empty value.

[`init<T>(T)`](/documentation/USDKit/USDValue/init(_:))

Creates a value wrapping `value`.

### Accessing the value

[`func isHolding<T>(T.Type) -> Bool`](/documentation/USDKit/USDValue/isHolding(_:))

Returns whether this value holds a value of type `T`.

### Inspecting the value

[`var typeName: String`](/documentation/USDKit/USDValue/typeName)

The name of the wrapped type.

[`var isEmpty: Bool`](/documentation/USDKit/USDValue/isEmpty)

Whether this value is empty.

[`struct Vec3d`](/documentation/USDKit/USDValue/Vec3d)

A 3-component double-precision vector.

### Structures

[`struct Matrix2d`](/documentation/USDKit/USDValue/Matrix2d)

A 2x2 matrix of double-precision floating-point values.

[`struct Matrix2f`](/documentation/USDKit/USDValue/Matrix2f)

A 2x2 matrix of single-precision floating-point values.

[`struct Matrix3d`](/documentation/USDKit/USDValue/Matrix3d)

A 3x3 matrix of double-precision floating-point values.

[`struct Matrix3f`](/documentation/USDKit/USDValue/Matrix3f)

A 3x3 matrix of single-precision floating-point values.

[`struct Matrix4d`](/documentation/USDKit/USDValue/Matrix4d)

A 4x4 matrix of double-precision floating-point values.

[`struct Matrix4f`](/documentation/USDKit/USDValue/Matrix4f)

A 4x4 matrix of single-precision floating-point values.

[`struct Quatd`](/documentation/USDKit/USDValue/Quatd)

[`struct Quatf`](/documentation/USDKit/USDValue/Quatf)

[`struct Quath`](/documentation/USDKit/USDValue/Quath)

A half-precision quaternion.

[`struct Vec2d`](/documentation/USDKit/USDValue/Vec2d)

A 2-component double-precision vector.

[`struct Vec2f`](/documentation/USDKit/USDValue/Vec2f)

A 2-component single-precision vector.

[`struct Vec2h`](/documentation/USDKit/USDValue/Vec2h)

A 2-component half-precision vector.

[`struct Vec2i`](/documentation/USDKit/USDValue/Vec2i)

A 2-component 32-bit integer vector.

[`struct Vec3f`](/documentation/USDKit/USDValue/Vec3f)

A 3-component single-precision vector.

[`struct Vec3h`](/documentation/USDKit/USDValue/Vec3h)

A 3-component half-precision vector.

[`struct Vec3i`](/documentation/USDKit/USDValue/Vec3i)

A 3-component 32-bit integer vector.

[`struct Vec4d`](/documentation/USDKit/USDValue/Vec4d)

A 4-component double-precision vector.

[`struct Vec4f`](/documentation/USDKit/USDValue/Vec4f)

A 4-component single-precision vector.

[`struct Vec4h`](/documentation/USDKit/USDValue/Vec4h)

A 4-component half-precision vector.

[`struct Vec4i`](/documentation/USDKit/USDValue/Vec4i)

A 4-component 32-bit integer vector.

### Instance Properties

[`var arrayCount: Int?`](/documentation/USDKit/USDValue/arrayCount)

The number of elements if this value holds an array. Returns `nil` otherwise.

[`var isArray: Bool`](/documentation/USDKit/USDValue/isArray)

Whether the wrapped value is an array.

### Instance Methods

[`func unsafeValue<T>(assumingType: T.Type) -> T`](/documentation/USDKit/USDValue/unsafeValue(assumingType:))

Returns the wrapped value as `T` without checking the dynamic type.

[`func value<T>(as: T.Type) -> T?`](/documentation/USDKit/USDValue/value(as:))

Returns the wrapped value if it is of type `T`, otherwise `nil`.

## Relationships

### Conforms To

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

---

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)