O'Reilly logo

Mastering iOS 11 Programming - Second Edition by Donny Wals

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Tracking walks with the pedometer

The first sensor we will explore is the pedometer. The pedometer is generally used to track the number of steps a user takes and to measure the distance a user has walked. This information is exposed to your application through the CMPedometer class. The pedometer data you retrieve from this class should be consistent regardless of the way the user holds their phone. Apple even stated in a WWDC 2015 session that the pedometer adapts to its user in order to become more accurate over time.

If you're looking to build an application that tracks a user's running or walking activity, CMPedometer is perfect for calculating the distance your user has traveled over a given time. There's more than one way to read information ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required