---
title: MTLCommandBufferHandler
framework: metal
role: symbol
role_heading: Type Alias
path: metal/mtlcommandbufferhandler
---

# MTLCommandBufferHandler

A completion handler signature a GPU device calls when it finishes scheduling a command buffer, or when the GPU finishes running it.

## Declaration

```swift
typealias MTLCommandBufferHandler = @Sendable (any MTLCommandBuffer) -> Void
```

## Parameters

- `commandBuffer`: The doc://com.apple.metal/documentation/Metal/MTLCommandBuffer instance that’s invoking the completion handler.

## Discussion

Discussion The MTLCommandBuffer type uses this signature in its methods that register your completion handlers, including addScheduledHandler(_:) and addCompletedHandler(_:).

## See Also

### Registering state change handlers

- [addScheduledHandler(_:)](metal/mtlcommandbuffer/addscheduledhandler(_:).md)
- [addCompletedHandler(_:)](metal/mtlcommandbuffer/addcompletedhandler(_:).md)
