---
title: CMDeviceMotion
framework: coremotion
role: symbol
role_heading: Class
path: coremotion/cmdevicemotion
---

# CMDeviceMotion

Encapsulated measurements of the attitude, rotation rate, and acceleration of a device.

## Declaration

```swift
class CMDeviceMotion
```

## Overview

Overview An application receives or samples CMDeviceMotion objects at regular intervals after calling the startDeviceMotionUpdates(using:to:withHandler:) method, the startDeviceMotionUpdates(to:withHandler:) method, the startDeviceMotionUpdates(using:) method, or the startDeviceMotionUpdates() method of the CMMotionManager class. The accelerometer measures the sum of two acceleration vectors: gravity and user acceleration. User acceleration is the acceleration that the user imparts to the device. Because Core Motion is able to track a device’s attitude using both the gyroscope and the accelerometer, it can differentiate between gravity and user acceleration. A CMDeviceMotion object provides both measurements in the gravity and userAcceleration properties.

## Topics

### Getting Attitude and Rotation Rate

- [attitude](coremotion/cmdevicemotion/attitude.md)
- [rotationRate](coremotion/cmdevicemotion/rotationrate.md)

### Getting Acceleration Data

- [gravity](coremotion/cmdevicemotion/gravity.md)
- [userAcceleration](coremotion/cmdevicemotion/useracceleration.md)

### Getting the Calibrated Magnetic Field

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

### Getting the Heading

- [heading](coremotion/cmdevicemotion/heading.md)

### Getting the Sensor Location

- [sensorLocation](coremotion/cmdevicemotion/sensorlocation-swift.property.md)
- [CMDeviceMotion.SensorLocation](coremotion/cmdevicemotion/sensorlocation-swift.enum.md)

### Instance Properties

- [headingAccuracy](coremotion/cmdevicemotion/headingaccuracy.md)

## Relationships

### Inherits From

- [CMLogItem](coremotion/cmlogitem.md)

### Inherited By

- [CMRecordedDeviceMotion](coremotion/cmrecordeddevicemotion.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)

## See Also

### Device motion

- [Getting processed device-motion data](coremotion/getting-processed-device-motion-data.md)
- [CMAttitude](coremotion/cmattitude.md)
- [CMAttitudeReferenceFrame](coremotion/cmattitudereferenceframe.md)
- [CMHeadphoneMotionManager](coremotion/cmheadphonemotionmanager.md)
