---
title: magneticField
framework: coremotion
role: symbol
role_heading: Instance Property
path: coremotion/cmdevicemotion/magneticfield
---

# magneticField

Returns the magnetic field vector with respect to the device.

## Declaration

```swift
var magneticField: CMCalibratedMagneticField { get }
```

## Discussion

Discussion The CMCalibratedMagneticField returned by this property gives you the total magnetic field in the device’s vicinity without device bias. Unlike the magneticField property of the CMMagnetometerData class, these values reflect the earth’s magnetic field plus surrounding fields, minus device bias. If the device does not have a magnetometer, the accuracy field of the property’s value (a CMCalibratedMagneticField structure) is CMMagneticFieldCalibrationAccuracy.uncalibrated.

## See Also

### Getting the Calibrated Magnetic Field

- [CMCalibratedMagneticField](coremotion/cmcalibratedmagneticfield.md)
- [CMMagneticFieldCalibrationAccuracy](coremotion/cmmagneticfieldcalibrationaccuracy.md)
