---
title: CMMagnetometerHandler
framework: coremotion
role: symbol
role_heading: Type Alias
path: coremotion/cmmagnetometerhandler
---

# CMMagnetometerHandler

The type of block callback for handling magnetometer data.

## Declaration

```swift
typealias CMMagnetometerHandler = (CMMagnetometerData?, (any Error)?) -> Void
```

## Discussion

Discussion Blocks of type CMMagnetometerHandler are called when there is magnetometer data to process. You pass the block into the startMagnetometerUpdates(to:withHandler:) method as the second argument. Blocks of this type return no value but take two arguments:

## See Also

### Managing Magnetometer Updates

- [magnetometerUpdateInterval](coremotion/cmmotionmanager/magnetometerupdateinterval.md)
- [startMagnetometerUpdates(to:withHandler:)](coremotion/cmmotionmanager/startmagnetometerupdates(to:withhandler:).md)
- [startMagnetometerUpdates()](coremotion/cmmotionmanager/startmagnetometerupdates().md)
- [stopMagnetometerUpdates()](coremotion/cmmotionmanager/stopmagnetometerupdates().md)
- [magnetometerData](coremotion/cmmotionmanager/magnetometerdata.md)
