---
title: "addCompletedHandler(_:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtliocommandbuffer/addcompletedhandler(_:)"
---

# addCompletedHandler(_:)

Adds a closure that Metal calls immediately after the GPU finishes executing the commands in the input/output command buffer.

## Declaration

```swift
func addCompletedHandler(_ block: @escaping MTLIOCommandBufferHandler)
```

## Parameters

- `block`: A Swift closure or an Objective-C block with your code.

## See Also

### Adding final commands

- [copyStatus(buffer:offset:)](metal/mtliocommandbuffer/copystatus(buffer:offset:).md)
