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

# USDLayer.Path

A path within a USD scene hierarchy.

```
struct Path
```

## Overview

Paths identify scene elements — prims like `/World/Character`,
properties like `/World/Character.visibility`, and other addressable
targets. Absolute paths begin with `/`; relative paths do not.

## Topics

### Initializers

[`init()`](/documentation/USDKit/USDLayer/Path/init())

Creates an empty path.

[`init(String)`](/documentation/USDKit/USDLayer/Path/init(_:))

Creates a path from its string representation.

[`init?(validating: String)`](/documentation/USDKit/USDLayer/Path/init(validating:))

Creates a path from its string representation, validating that
`path` is well-formed.

### Instance Properties

[`var ancestors: [USDLayer.Path]`](/documentation/USDKit/USDLayer/Path/ancestors)

All ancestor paths from leaf to root, excluding self.

[`var depth: Int`](/documentation/USDKit/USDLayer/Path/depth)

The number of components in the path.

[`var isAbsolute: Bool`](/documentation/USDKit/USDLayer/Path/isAbsolute)

Whether the path begins with `/`.

[`var isNamespacedProperty: Bool`](/documentation/USDKit/USDLayer/Path/isNamespacedProperty)

Whether the leaf property name contains a namespace.

[`var isPrimProperty: Bool`](/documentation/USDKit/USDLayer/Path/isPrimProperty)

Whether the path is a property on a prim, as opposed
to one on a relationship target.

[`var isRelationalAttribute: Bool`](/documentation/USDKit/USDLayer/Path/isRelationalAttribute)

Whether the path is an attribute on a relationship target.

[`var isRootPrim: Bool`](/documentation/USDKit/USDLayer/Path/isRootPrim)

Whether the path is a top-level prim like a child of the absolute root.

[`var kind: USDLayer.Path.Kind`](/documentation/USDKit/USDLayer/Path/kind-swift.property)

What kind of element the path’s leaf represents.

[`var name: USDToken`](/documentation/USDKit/USDLayer/Path/name)

The identifier of the path’s leaf element.

[`var parent: USDLayer.Path?`](/documentation/USDKit/USDLayer/Path/parent)

The parent of this path, or `nil` if this path is the absolute root
or the empty path.

[`var primPath: USDLayer.Path`](/documentation/USDKit/USDLayer/Path/primPath)

The containing prim path, stripped of any property, target, or
variant selection elements.

[`var target: USDLayer.Path?`](/documentation/USDKit/USDLayer/Path/target)

The target component if the path contains one, otherwise `nil`.

[`var variantSelection: (set: String, variant: String)?`](/documentation/USDKit/USDLayer/Path/variantSelection)

The variant set and value if the path’s leaf is a variant selection,
otherwise `nil`.

### Instance Methods

[`func absolute(at: USDLayer.Path) -> USDLayer.Path`](/documentation/USDKit/USDLayer/Path/absolute(at:))

Returns this path made absolute, anchored at the given path.

[`func appending(child: USDToken) -> USDLayer.Path`](/documentation/USDKit/USDLayer/Path/appending(child:))

Returns a new path with the named child prim appended.

[`func appending(path: USDLayer.Path) -> USDLayer.Path`](/documentation/USDKit/USDLayer/Path/appending(path:))

Returns a new path with `newSuffix` appended.

[`func appending(property: USDToken) -> USDLayer.Path`](/documentation/USDKit/USDLayer/Path/appending(property:))

Returns a new path with the named property appended.

[`func appending(relationalAttribute: USDToken) -> USDLayer.Path`](/documentation/USDKit/USDLayer/Path/appending(relationalAttribute:))

Returns a new path with a relational attribute appended.

[`func appending(target: USDLayer.Path) -> USDLayer.Path`](/documentation/USDKit/USDLayer/Path/appending(target:))

Returns a new path with a relationship target appended.

[`func appending(variantSet: USDToken, variant: USDToken) -> USDLayer.Path`](/documentation/USDKit/USDLayer/Path/appending(variantSet:variant:))

Returns a new path with a variant selection appended.

[`func commonPrefix(with: USDLayer.Path) -> USDLayer.Path`](/documentation/USDKit/USDLayer/Path/commonPrefix(with:))

Returns the longest common ancestor path of this path and `other`.

[`func hasPrefix(USDLayer.Path) -> Bool`](/documentation/USDKit/USDLayer/Path/hasPrefix(_:))

Returns a Boolean value that indicates whether this path begins
with `prefix`.

[`func relative(to: USDLayer.Path) -> USDLayer.Path`](/documentation/USDKit/USDLayer/Path/relative(to:))

Returns this path made relative to the given anchor.

[`func replacing(name: USDToken) -> USDLayer.Path`](/documentation/USDKit/USDLayer/Path/replacing(name:))

Returns a new path with the leaf name replaced.

[`func replacing(target: USDLayer.Path) -> USDLayer.Path`](/documentation/USDKit/USDLayer/Path/replacing(target:))

Returns a new path with the target component replaced.

[`func strippingAllVariantSelections() -> USDLayer.Path`](/documentation/USDKit/USDLayer/Path/strippingAllVariantSelections())

Returns a new path with all variant selections removed.

### Type Properties

[`static let absoluteRoot: USDLayer.Path`](/documentation/USDKit/USDLayer/Path/absoluteRoot)

The absolute root, `/`.

[`static let empty: USDLayer.Path`](/documentation/USDKit/USDLayer/Path/empty)

The empty path.

### Enumerations

[`enum Kind`](/documentation/USDKit/USDLayer/Path/Kind-swift.enum)

The classification of the path’s leaf element.

## Relationships

### Conforms To

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

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

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

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

[`USDValueProtocol`](/documentation/USDKit/USDValueProtocol)

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

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

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

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

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

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

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

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

---

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)