Custom Component
Swift field type support for custom components is determined by Reality Composer Pro's codegen and Xcode validation pipeline. Types are tested by compiling fixtures in RCP and inspecting which fields survive the build process.
/// type coverage
/// rcp authored schema
Type support matrix for custom component fields in Reality Composer Pro. Each Swift type was compiled in an RCP test fixture and inspected for field survival.
/// scalar types
Primitive integer, floating-point, boolean, and string types.
| Swift Type | OpenUSD Type | RCP Support |
|---|---|---|
Bool | bool | ✓ |
Int | int | ✓ |
Int8 | int | ✓ |
Int16 | int | ✓ |
Int32 | int | ✓ |
Int64 | int64 | ✓ |
UInt | uint | ✓ |
UInt8 | uchar | ✓ |
UInt16 | uint | ✓ |
UInt32 | uint | ✓ |
UInt64 | uint64 | ✓ |
Float | float | ✓ |
Double | double | ✓ |
Float16 | half | ✗ |
String | string | ✓ |
/// vector types
SIMD vector types for positions, directions, and colors.
| Swift Type | OpenUSD Type | RCP Support |
|---|---|---|
SIMD2<Float> | float2 | ✓ |
SIMD3<Float> | float3 | ✓ |
SIMD4<Float> | float4 | ✓ |
SIMD2<Double> | double2 | ✓ |
SIMD3<Double> | double3 | ✓ |
SIMD4<Double> | double4 | ✓ |
SIMD2<Float16> | half2 | ✗ |
SIMD3<Float16> | half3 | ✗ |
SIMD4<Float16> | half4 | ✗ |
SIMD2<Int32> | int2 | ✗ |
SIMD3<Int32> | int3 | ✗ |
SIMD4<Int32> | int4 | ✗ |
/// quaternion types
Rotation representations used in transforms.
| Swift Type | OpenUSD Type | RCP Support |
|---|---|---|
simd_quatf | quatf | ✓ |
simd_quatd | quatd | ✓ |
simd_quath | quath | ✗ |
/// array types
Collections of scalar or vector values.
| Swift Type | OpenUSD Type | RCP Support |
|---|---|---|
[Bool] | bool[] | ✗ |
[Int] | int[] | ✗ |
[Float] | float[] | ✗ |
[Double] | double[] | ✗ |
[String] | string[] | ✗ |
[SIMD3<Float>] | float3[] | ✗ |
/// enum types
String-based and Int-based raw value enums.
| Swift Type | OpenUSD Type | RCP Support |
|---|---|---|
String enum (RawRepresentable) | token | ✓ |
Int enum (RawRepresentable) | int | ✓ |
/// optional types
Nullable wrappers — partial support, needs confirmation.
| Swift Type | OpenUSD Type | RCP Support |
|---|---|---|
Bool? | bool | ✗ needs confirmation |
Int? | int | ✓ needs confirmation |
Float? | float | ✓ needs confirmation |
Double? | double | ✗ needs confirmation |
String? | string | ✓ needs confirmation |
SIMD3<Float>? | float3 | ✓ needs confirmation |
/// not yet tested
Types that exist in OpenUSD but have not been empirically tested in RCP.
| Swift Type | OpenUSD Type | RCP Support |
|---|---|---|
simd_double2x2 | matrix2d | ? |
simd_double3x3 | matrix3d | ? |
simd_double4x4 | matrix4d | ? |
URL? | asset | ? |
UUID? | — | ? |
Date? | — | ? |
Data? | — | ? |
nested Codable struct | — | ? |
/// usda scaffold
def RealityKitCustomComponent "ModuleName_ComponentName" (
active = true
)
{
uniform token info:id = "ModuleName.ComponentName"
}
A custom component with an Int field produces this USDA —
zero field attributes beyond info:id. The field data is serialized
elsewhere in the build pipeline.
/// notes & resources
-
Custom component field data does not appear as USD attributes
The USDA file only contains the component scaffold with info:id. Field data is serialized in the Swift/Xcode build pipeline, not the USD authoring layer.
-
The complete set of supported custom component field types is bounded by OpenUSD's finite type system, not Swift's infinite one.
OpenUSD has a closed, enumerable set of SdfValueTypeNames. Swift's type system is open-ended and Turing-complete. RCP cannot support all Swift types — it supports the USD-serializable subset: Swift types that map directly to SdfValueTypeNames, plus special cases like enums, arrays, and optionals.
details → -
Custom components support only 'simpler data' types — scalars, strings, SIMD values, and enums — with Xcode build-time errors for unsupported types.
Apple's WWDC 2023 session 'Work with Reality Composer Pro content in Xcode' explicitly defines custom component type constraints. The session demonstrates PointOfInterestComponent with String, custom enum, and Optional<String> fields, and warns that Xcode produces errors for types RCP cannot serialize.
details →
- OpenUSD SdfValueTypeNames
- Apple Developer Documentation — Component A representation of a geometry or a behavior that you apply to an entity.
- Compiling Reality: The Technical Reality Deep dive into how Reality Composer Pro compiles USD schemas into Swift code, bridging the gap between scene description and runtime ECS components.
- Work with Reality Composer Pro content in Xcode WWDC 2023 session officially documenting custom component type constraints. At ~22:31, Apple confirms support for 'simpler data' types — scalars, strings, SIMD values, and enums.