---
title: MTLDeviceNotificationHandler
framework: metal
role: symbol
role_heading: Type Alias
path: metal/mtldevicenotificationhandler
---

# MTLDeviceNotificationHandler

A Swift closure or an Objective-C block that Metal calls when the system adds or removes a GPU device.

## Declaration

```swift
typealias MTLDeviceNotificationHandler = @Sendable (any MTLDevice, MTLDeviceNotificationName) -> Void
```

## Parameters

- `device`: An doc://com.apple.metal/documentation/Metal/MTLDevice that represents the GPU that’s sending the notification.
- `notifyName`: A notification that represents a change to a GPU device in the system.

## See Also

### Locating GPUs

- [Finding multiple GPUs on an Intel-based Mac](metal/finding-multiple-gpus-on-an-intel-based-mac.md)
- [Getting the GPU that drives a view’s display](metal/getting-the-gpu-that-drives-a-views-display.md)
- [MTLCopyAllDevices()](metal/mtlcopyalldevices().md)
- [MTLCopyAllDevicesWithObserver(handler:)](metal/mtlcopyalldeviceswithobserver(handler:).md)
- [MTLRemoveDeviceObserver(_:)](metal/mtlremovedeviceobserver(_:).md)
- [CGDirectDisplayCopyCurrentMetalDevice(_:)](coregraphics/cgdirectdisplaycopycurrentmetaldevice(_:).md)
- [MTLDeviceNotificationName](metal/mtldevicenotificationname.md)
