---
title: CMMagnetometerData
framework: coremotion
role: symbol
role_heading: Class
path: coremotion/cmmagnetometerdata
---

# CMMagnetometerData

Measurements of the Earth’s magnetic field relative to the device.

## Declaration

```swift
class CMMagnetometerData
```

## Overview

Overview Your application can obtain samples of magnetometer measurements, as represented by instances of this class, from the block handler of the startMagnetometerUpdates(to:withHandler:) method or from the magnetometerData property of the CMMotionManager class. note: The magnetometerData property of CMMotionManager provides a non-nil value only if you have called the startMagnetometerUpdates() method or the startMagnetometerUpdates(to:withHandler:) method to start magnetometer updates.

## Topics

### Getting the Field Strength

- [magneticField](coremotion/cmmagnetometerdata/magneticfield.md)
- [CMMagneticField](coremotion/cmmagneticfield.md)

## Relationships

### Inherits From

- [CMLogItem](coremotion/cmlogitem.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)
