---
title: CMHeadphoneMotionManager.DeviceMotionHandler
framework: coremotion
role: symbol
role_heading: Type Alias
path: coremotion/cmheadphonemotionmanager/devicemotionhandler
---

# CMHeadphoneMotionManager.DeviceMotionHandler

The type of block callback for handling headphone-motion data.

## Declaration

```swift
typealias DeviceMotionHandler = (CMDeviceMotion?, (any Error)?) -> Void
```

## Discussion

Discussion The system calls CMDeviceMotionHandler blocks when there is device-motion data to process. You pass the block into startDeviceMotionUpdates(to:withHandler:) as the second argument. Blocks of this type return no value, but take two arguments:

## See Also

### Connecting and Disconnecting Headphones

- [headphoneMotionManagerDidConnect(_:)](coremotion/cmheadphonemotionmanagerdelegate/headphonemotionmanagerdidconnect(_:).md)
- [headphoneMotionManagerDidDisconnect(_:)](coremotion/cmheadphonemotionmanagerdelegate/headphonemotionmanagerdiddisconnect(_:).md)
