A Swift Package for using OpenUSD, Pixar's Universal Scene Description
87
stars
58
commits
C++
primary language
Sep 8, 2026
updated
A Swift Package for using OpenUSD, Pixar's Universal Scene Description
Before you can start using SwiftUsd, you need to add it as a dependency to your Xcode project or Swift Package, and then configure a few build settings.
https://github.com/apple/SwiftUsd as the URL.C++ and Objective-C Interoperability to C++ / Objective-C++ (SWIFT_OBJC_INTEROP_MODE=objcxx).C++ Language Dialect to GNU++17 [-std=gnu++17] (CLANG_CXX_LANGUAGE_STANDARD=gnu++17).dependencies: [
.package(url: "https://github.com/apple/SwiftUsd", from: "8.1.0"),
]
.target(name: "MyTarget",
dependencies: [.product(name: "OpenUSD", package: "SwiftUsd")],
swiftSettings: [
.interoperabilityMode(.Cxx)
]),
let package = Package(
name: "MyPackage",
targets: [...],
cxxLanguageStandard: .gnucxx17
)
Once you've added SwiftUsd as a package depedency to your Xcode project or Swift Package, enabled Swift-Cxx interop, and set the C++ version to GNU++17, you're ready to start using SwiftUsd:
import OpenUSD
func makeHelloWorldString() -> String {
let stage = Overlay.Dereference(pxr.UsdStage.CreateInMemory())
stage.DefinePrim("/hello", .UsdGeomTokens.Xform)
stage.DefinePrim("/hello/world", .UsdGeomTokens.Sphere)
return stage.ExportToString() ?? "nil"
}
See the online documentation here.
Alternatively, open the included SwiftUsd.doccarchive in Xcode for local viewing.
C++
96.1%
C
1.6%
Swift
1.2%
A Swift Package for using OpenUSD, Pixar's Universal Scene Description
87
stars
58
commits
C++
primary language
Sep 8, 2026
updated
A Swift Package for using OpenUSD, Pixar's Universal Scene Description
Before you can start using SwiftUsd, you need to add it as a dependency to your Xcode project or Swift Package, and then configure a few build settings.
https://github.com/apple/SwiftUsd as the URL.C++ and Objective-C Interoperability to C++ / Objective-C++ (SWIFT_OBJC_INTEROP_MODE=objcxx).C++ Language Dialect to GNU++17 [-std=gnu++17] (CLANG_CXX_LANGUAGE_STANDARD=gnu++17).dependencies: [
.package(url: "https://github.com/apple/SwiftUsd", from: "8.1.0"),
]
.target(name: "MyTarget",
dependencies: [.product(name: "OpenUSD", package: "SwiftUsd")],
swiftSettings: [
.interoperabilityMode(.Cxx)
]),
let package = Package(
name: "MyPackage",
targets: [...],
cxxLanguageStandard: .gnucxx17
)
Once you've added SwiftUsd as a package depedency to your Xcode project or Swift Package, enabled Swift-Cxx interop, and set the C++ version to GNU++17, you're ready to start using SwiftUsd:
import OpenUSD
func makeHelloWorldString() -> String {
let stage = Overlay.Dereference(pxr.UsdStage.CreateInMemory())
stage.DefinePrim("/hello", .UsdGeomTokens.Xform)
stage.DefinePrim("/hello/world", .UsdGeomTokens.Sphere)
return stage.ExportToString() ?? "nil"
}
See the online documentation here.
Alternatively, open the included SwiftUsd.doccarchive in Xcode for local viewing.
C++
96.1%
C
1.6%
Swift
1.2%