One Logo Pool Ball
USDKit · IOS API REFERENCE

USDValue

struct · iOS 27.0+ · SDK 27.1

struct USDValue

A type-erased container for a value stored in a Universal Scene Description file. `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.

Members (9)

get · iOS 27.0+

arrayCount

TypeScript
get arrayCount(): (number) | null
Swift declaration
var arrayCount: Int? { get }

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

method · iOS 27.0+

unsafeValue

TypeScript
unsafeValue(type?: "Bool" | "Int" | "UInt" | "Double" | "Float" | "String"): unknown
Swift declaration
func unsafeValue<T>(assumingType type: T.Type = T.self) -> T where T : USDValueProtocol

Returns the wrapped value as `T` without checking the dynamic type. - Important: The behaviour is undefined when `T` does not match the stored type. Prefer ``value(as:)`` unless you have already confirmed the type with ``isHolding(_:)``.

method · iOS 27.0+

value

TypeScript
value(type?: "Bool" | "Int" | "UInt" | "Double" | "Float" | "String"): (unknown) | null
Swift declaration
func value<T>(as type: T.Type = T.self) -> T? where T : USDValueProtocol

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

get · iOS 27.0+

isArray

TypeScript
get isArray(): boolean
Swift declaration
var isArray: Bool { get }

Whether the wrapped value is an array.

get · iOS 27.0+

isEmpty

TypeScript
get isEmpty(): boolean
Swift declaration
var isEmpty: Bool { get }

Whether this value is empty.

get · iOS 27.0+

typeName

TypeScript
get typeName(): string
Swift declaration
var typeName: String { get }

The name of the wrapped type.

method · iOS 27.0+

isHolding

TypeScript
isHolding(type: "Bool" | "Int" | "UInt" | "Double" | "Float" | "String"): boolean
Swift declaration
func isHolding<T>(_ type: T.Type) -> Bool where T : USDValueProtocol

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

init · iOS 27.0+

init

TypeScript
static init(): USDValue
Swift declaration
init()

Creates an empty value.

init · iOS 27.0+

init

TypeScript
static init9821(value: number): USDValue
Swift declaration
init<T>(_ value: T) where T : USDValueProtocol

Creates a value wrapping `value`. - Parameter value: A value of any type that conforms to ``USDValueProtocol``.

Skipped declarations

No declarations were skipped in this snapshot.

All USDKit types →