The number of steps the user has taken with the device.


class CMStepCounter : NSObject


Step information is gathered on devices with the appropriate built-in hardware and stored so that you can run queries to determine the user’s recent physical activity. You use this class to gather both current step data and any historical data.


Determining Step Counting Availability

class func isStepCountingAvailable() -> Bool

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

Starting and Stopping Step Counting Updates

func stopStepCountingUpdates()

Stops the delivery of step-counting updates to your app.

typealias CMStepUpdateHandler

A block that reports the number of steps recorded since updates began.

Getting Historical Step Counting Data

func queryStepCountStarting(from: Date, to: Date, to: OperationQueue, withHandler: CMStepQueryHandler)

Gathers and returns historical step count data for the specified time period.

typealias CMStepQueryHandler

A block that reports the number of steps for a query operation.


Inherits From

Conforms To

See Also


class CMPedometer

An object for fetching the system-generated live walking data.

class CMPedometerData

Information about the distance traveled by a user on foot.

class CMPedometerEvent

A change in the user's pedestrian activity.