<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/ShaderGraph/NodeLibrary",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:11ShaderGraphAAC11NodeLibraryC"
  },
  "title" : "ShaderGraph.NodeLibrary"
}
-->

# ShaderGraph.NodeLibrary

A catalog of node definitions supported by RealityKit.

```
final class NodeLibrary
```

## Overview

Use a library to discover available [`ShaderGraph.NodeDefinition`](/documentation/RealityKit/ShaderGraph/NodeDefinition) values and add instances
of them to a [`ShaderGraph`](/documentation/RealityKit/ShaderGraph).

```swift
let library = ShaderGraph.NodeLibrary(version: .materialX138)
let pbrDef = library.definition(named: "ND_realitykit_pbr_surfaceshader")!
let pbrNode = try library.makeNode(from: pbrDef)
let pbr = graph.addNode(pbrNode)
```

## Topics

### Structures

[`struct Version`](/documentation/RealityKit/ShaderGraph/NodeLibrary/Version-swift.struct)

### Initializers

[`init(version: ShaderGraph.NodeLibrary.Version)`](/documentation/RealityKit/ShaderGraph/NodeLibrary/init(version:))

Creates a library containing all node definitions supported by RealityKit
for the given library version.

### Instance Properties

[`var definitions: some Collection<ShaderGraph.NodeDefinition>`](/documentation/RealityKit/ShaderGraph/NodeLibrary/definitions)

All node definitions in this library.

[`let version: ShaderGraph.NodeLibrary.Version`](/documentation/RealityKit/ShaderGraph/NodeLibrary/version-swift.property)

### Instance Methods

[`func definition(named: String) -> ShaderGraph.NodeDefinition?`](/documentation/RealityKit/ShaderGraph/NodeLibrary/definition(named:))

Returns the definition with the given name, or `nil` if no such definition exists in this library.

[`func definitions(function: String, input: ShaderGraph.DataType) -> [ShaderGraph.NodeDefinition]`](/documentation/RealityKit/ShaderGraph/NodeLibrary/definitions(function:input:))

Returns all definitions that implement the given function with the specified input type.

[`func definitions(function:inputs:)`](/documentation/RealityKit/ShaderGraph/NodeLibrary/definitions(function:inputs:))

Returns all definitions that implement the given function with the specified input types, in order.

[`func definitions(function: String, output: ShaderGraph.DataType) -> [ShaderGraph.NodeDefinition]`](/documentation/RealityKit/ShaderGraph/NodeLibrary/definitions(function:output:))

Returns all definitions that implement the given function with the specified output type.

[`func makeNode(from: ShaderGraph.NodeDefinition) throws -> ShaderGraph.Node`](/documentation/RealityKit/ShaderGraph/NodeLibrary/makeNode(from:))

Creates a node instance of the given definition.

---

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)