<!--
{
  "availability" : [
    "iOS: 8.0.0 - 26.0.0",
    "iPadOS: 8.0.0 - 26.0.0",
    "macCatalyst: 13.1.0 - 26.0.0",
    "macOS: 10.8.0 - 26.0.0",
    "tvOS: 9.0.0 - 26.0.0",
    "visionOS: 1.0.0 - 26.0.0",
    "watchOS: 3.0.0 - 26.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "SceneKit",
  "identifier" : "/documentation/SceneKit/SCNProgram/handleBinding(ofBufferNamed:frequency:handler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SceneKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SCNProgram(im)handleBindingOfBufferNamed:frequency:usingBlock:"
  },
  "title" : "handleBinding(ofBufferNamed:frequency:handler:)"
}
-->

# handleBinding(ofBufferNamed:frequency:handler:)

Registers a block for SceneKit to call at render time for binding a Metal buffer to the shader program.

```
func handleBinding(ofBufferNamed name: String, frequency: SCNBufferFrequency, handler block: @escaping SCNBufferBindingBlock)
```

## Parameters

`name`

The name identifying the buffer in Metal shader source code.

`frequency`

An option specifying whether SceneKit calls the block only once per rendered frame or more frequently (for example, once for each object to be rendered).

`block`

A block to be run when SceneKit prepares for rendering with the Metal shader.

## Discussion

Use this method to associate a block with a Metal shader program to handle setup of a buffer used in that shader. SceneKit calls your block before rendering any objects whose [`program`](/documentation/SceneKit/SCNShadable/program) property is set to this [`SCNProgram`](/documentation/SceneKit/SCNProgram) object. In the block, use the [`writeBytes(_:count:)`](/documentation/SceneKit/SCNBufferStream/writeBytes(_:count:)) method to provide data for the buffer.

---

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)