What's new in HealthKit

Description: HealthKit is an essential framework that integrates first- and third-party health and fitness data to help people manage their personal health information. Learn about HealthKit’s latest updates, which provide read access to electrocardiograms on Apple Watch and log and track over a dozen new symptoms and their severity. We’ll also go through the latest mobility data types like walking speed and step length to help people monitor and understand their mobility over time.

Tracking Symptoms

30 Symptoms data types have been added to Health Kit this year, they are shown below.

Electrocardiogram (ECG)

ECG samples can now be read as an HKElectrocardiogram:

/// Represents a collection of voltage measurements.
class HKElectrocardiogram: HKSample {
  var classification: HKElectrocardiogram.Classification 
  var symptomsStatus: HKElectrocardiogram.SymptomsStatus 
  var averageHeartRate: HKQuantity? 
  var samplingFrequency: HKQuantity? 
  var number0fVoltageMeasurements: Int 
}

Here's the description and documentation reference for such properties:

If you want individual measurements you have to run the HKElectrocardiogramQuery:

// Query 
class HKElectrocardiogramQuery: HKQuery {
  public enum Result {
    case measurement(HKElectrocardiogram.VoltageMeasurement)
    case error(Error)
    case done 
  }

  public convenience init(
    _ ecg: HKElectrocardiogram, 
    dataHandler: @escaping (HKElectrocardiogramQuery, HKElectrocardiogramQuery.Result) -> Void
  )
}

Mobility

New set of mobility types:

  • walking speed and step length
  • walking asymmetry and double support percentage
  • stair ascent and descent speed
  • six minute walk test

Missing anything? Corrections? Contributions are welcome 😃

Related

Written by

Michael Charland

Michael Charland

Michael Charland is an experienced iOS Software Developer from Canada with a love for developing in Swift, testing, and DevOps.

He's been working with computers for most of his life. Starting with the Commodore-64 doing LOAD "*",8,1 up until now working on fancy iPhones and MacBooks.

Federico Zanetello

Federico Zanetello

iOS Engineer with strong passion for Swift, minimalism, and design. When he’s not busy automating things, he can be found writing at FIVE STARS and/or playing with the latest shiny toys.