Class

CMPedometer

Use a CMPedometer object to fetch pedestrian-related data. You use a pedometer object to retrieve step counts and other information about the distance traveled and the number of floors ascended or descended. The pedometer object manages a cache of historic data that you can query or you can ask for live updates as the data is processed.

Overview

To use a pedometer object, create an instance of this class and call the appropriate methods. Use the queryPedometerData(from:to:withHandler:) method to retrieve data that has already been gathered. To get live updates, use the startUpdates(from:withHandler:) method to start the delivery of events to the handler you provide.

Symbols

Determining Pedometer Availability

class func isStepCountingAvailable()

Returns a Boolean value indicating whether step counting is available on the current device.

class func isDistanceAvailable()

Returns a Boolean value indicating whether distance estimation is available on the current device.

class func isFloorCountingAvailable()

Returns a Boolean value indicating whether floor counting is available on the current device.

class func isPaceAvailable()

Returns a Boolean value indicating whether pace information is available on the current device.

class func isCadenceAvailable()

Returns a Boolean value indicating whether cadence information is available on the current device.

Generating Live Pedometer Data

func startUpdates(from: Date, withHandler: CMPedometerHandler)

Starts the delivery of recent pedestrian-related data to your app.

func stopUpdates()

Stops the delivery of recent pedestrian data updates to your app.

Fetching Historical Pedometer Data

func queryPedometerData(from: Date, to: Date, withHandler: CMPedometerHandler)

Retrieves the data between the specified start and end dates.

Constants

CMPedometerHandler

A block for processing pedometer-related data.

Relationships

Inherits From

Conforms To