Highlight
iOS 14 and watchOS 7 add pace, stride length, double support time, walking asymmetry, stair-climbing speed, six-minute walking distance and improved VO2Max to HealthKit, allowing apps to track changes in mobility with everyday iPhones and Apple Watches.
Core Content
Clinically, the common method of assessing how a person walks is not easy. The six-minute walk test requires a 30-meter corridor, the questionnaire relies on recall and subjective feelings, and the motion capture requires expensive equipment, cameras, markers, and trained technicians. They can give valuable data, but most are just snapshots of a few points in time.
The starting point of this session is very specific: what users really care about is how they go about their daily lives. Apple is opening a set of Mobility Metrics to HealthKit in iOS 14 and watchOS 7. When the iPhone is placed in your pocket or on your waist, it can record the pace, step length, double support time and walking asymmetry in continuous walking clips on flat ground. Apple Watch also provides walking speed up and down stairs, predicted six-minute walking distance, and VO2Max estimates for low-energy users.
The speaker uses the example of Jamie’s recovery process after an ankle injury. The app no longer just counts the steps taken today, but reads the pace from 30 days before the injury to 60 days after the injury, finds the decline caused by the injury, and then charts the small progress during the recovery period. Later, double support time and six-minute walking distance are added to help users understand the gait quality and physical recovery behind speed changes.
Detailed Content
No code snippets are exposed for this session. The following will only expand based on the API name, data processing steps and restrictions in the verbatim draft, without placing fenced code.
Read new Mobility Metrics
(03:22) Apple is adding a new set of mobility metrics to HealthKit. The iPhone side includes walking speed, step length, double support time and walking asymmetry. The Apple Watch side includes up and down stairs speed, predicted six-minute walk distance, and improved VO2Max.
Key points:
- walking speed is a HealthKit quantity type. The example app only reads data and does not write it back to HealthKit, so authorization requests only require read access.
- The query begins 30 days before Jamie’s injury and ends 60 days after the injury. In this way, a baseline can be established first and then the recovery curve can be observed.
- The query result callback gets matching HKSamples. Active users may return hundreds of walking speed samples, and it would be very crowded to directly draw all the points.
- Walking speed is not the total amount of walking throughout the day. It records walking segments on flat ground, in continuous, stable conditions, and is therefore more suitable for comparing changes before and after rehabilitation.
Press all-day samples into trends
(11:03) Data collected passively throughout the day is noisy. The same person’s pace can be affected by catching a meeting, walking the dog, the speed of fellow travelers, weather and commute style. The speaker suggested teaming up with doctors, physical therapists, biomechanics experts or data science teams to first decide on a truly meaningful aggregation method for the current scenario.
In Jamie’s case, daily 95th percentile pace was selected. The reason is that the rehabilitation scenario is more concerned with walking performance close to the highest ability, such as whether you can walk across the road quickly; the 95th percentile is less likely to be biased by outliers than the single highest value.
Key points:
- Using midnight as the starting and ending points of each day, use enumerateDates to traverse the query range by day.
- The output array uses optional values, because the user may not have a mobile phone on a certain day, has too few activities, or does not have enough walking speed data.
- For dates with data, take the walking speed values from HKQuantitySamples and calculate them in miles per hour units used in the chart.
- Sort each day first, and then take the 95th percentile; the recovery period is observed weekly, so a 7-day average is done.
- The date of injury is used as the calculation boundary. Do not mix pre-injury baseline and post-injury recovery values in the same smoothing window.
Explaining speed changes with gait quality
(14:27) A decrease in speed does not necessarily only indicate regression in recovery. Weather, commuting, and walking with the family can all change the pace of the day. The value of Mobility Metrics lies in the ability to look at walking speed and walking quality together.
Double support time represents the proportion of time during a walk that both feet are in contact with the ground at the same time. The speaker explained that a lower number is generally better because it means the walker spends less time stabilizing his or her feet. In Jamie’s case, double support time continued to return to pre-injury levels even as pace slowed during the heat wave, giving the app a second perspective in interpreting recovery progress.
Key points:
- Double support time and six-minute walk distance can be added to the request list and queried like walking speed.
- The six-minute walk distance may come from predictions from the Apple Watch, or it may be clinic test results manually entered by the user in the Health App.
- Need to check SourceRevision and Metadata of HKSample. The bundle identifier can be used to identify the data recorded by Apple. When the WasUserEntered metadata key is true, it represents manual entry by the user.
- The chart can divide clinic manual test values and Apple Watch predicted values into two sets of points. The former is a small number of snapshots in red, the latter is a continuous system estimate in green.
Remember collection conditions and metadata
(19:18) The final suggestion focuses on boundary conditions. The iPhone’s mobility values require users to hold the phone close to their waist and walk on level ground. Six-minute walk distance requires one week of Apple Watch wearing data. The sample also comes with metadata such as start/end times and calibration status for predicting six-minute walking distance.
Key points:
- If your app requires lower-level motion signals, you can use CMMotionManager to read inertial sensor data from iPhone and Apple Watch.
- If you want to track altitude changes, you can use CMAltimeter.
- A headphone motion API was also added in 2020, allowing AirPods Pro to become the new inertial signal position.
- Aggregation strategy should not be decided only by engineers. The presentation explicitly recommended working with physiotherapists, doctors, and biomechanics experts to define the meaning of the indicators.
Core Takeaways
-
Rehabilitation Progress Panel: Lets the user enter the date of injury and reads the walking speed 30 days before and 60 days after the injury. Starting Point displays the recovery curve with the daily 95th percentile and 7-day average, with the day of injury plotted on the graph to help users see small improvements.
-
Gait quality explanation card: Add double support time below the pace curve. When the speed drops during the day, if the double support time is still improving, the app can interpret it as gait stability continues to recover, preventing the user from focusing on a single speed value.
-
Clinic test comparison chart: Put the six-minute walk test manually entered by Health App and the six-minute walk distance predicted by Apple Watch on the same chart. The implementation entry point is to read samples of the same type, and then use SourceRevision and WasUserEntered metadata to distinguish the source.
-
Care Team Weekly Report: For CareKit scenarios, the weekly walking speed, double support time and six-minute walk distance are summarized into a one-page report. The report only displays trends, missing dates and collection conditions, making it easier for physical therapists to determine whether the training plan needs to be adjusted.
-
Research Mobility Log: Combines ResearchKit charts and questionnaires to allow participants to add pain, fatigue, weather, or changes in exercise plans alongside mobility metrics. This allows passively collected walking samples and active reports to be analyzed on the same timeline.
Related Sessions
- What’s new in HealthKit — Learn about the ECG, symptom logging, and mobility data types new to HealthKit in 2020.
- Getting started with HealthKit — Complete HealthKit authorization, privacy, reading and writing data, and built-in query foundations.
- Synchronize health data with HealthKit — Learn to use sync identifier and HKAnchoredObjectQuery to manage cross-device health data synchronization.
- What’s new in CareKit — See CareKit views, data storage, and privacy design in Care apps.
- What’s new in ResearchKit — Learn about updates to onboarding, questionnaires, and active tasks in ResearchKit.
Comments
GitHub Issues · utterances