An object that manages access to the motion data stored by the device.


Motion data reflects whether the user is walking, running, in a vehicle, or stationary for periods of time. A navigation app might look for changes in the current type of motion and offer different directions for each. Using this class, you can ask for notifications when the current type of motion changes or you can gather past motion change data.


Determining Activity Availability

class func isActivityAvailable()

Returns a Boolean indicating whether motion data is available on the current device.

Starting and Stopping Activity Updates

func startActivityUpdates(to: OperationQueue, withHandler: CMMotionActivityHandler)

Starts the delivery of current motion data updates to your app.

func stopActivityUpdates()

Stops the delivery of motion updates to your app

Getting Historical Activity Data


typealias CMMotionActivityHandler

A block that reports the current motion associated with the device.

typealias CMMotionActivityQueryHandler

A block that reports the motion updates that occurred between the specified query interval.


Inherits From

Conforms To

See Also

Historical Data

class CMMotionActivity

The data for a single motion update event.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software