Contents

typesToCollect

The quantity type samples that the data source automatically sends to the workout builder.

Declaration

var typesToCollect: Set<HKQuantityType> { get }

Discussion

The workout builder automatically collects the listed data types. The available data types vary depending on platform, the person’s settings and the workout configuration, and can include types like basalEnergyBurned, activeEnergyBurned, heartRate, distanceWalkingRunning, distanceCycling, distanceSwimming, or distanceWheelchair.

Some datatypes require you to support an external sensor like heartRate on iPhone and iPad and cycling power and cycling cadence on Apple Watch. Once a person pairs a device, HealthKit handles getting the data from the device and saving it as samples to the Health Store, making it available to your app.

To monitor this data, add a delegate to the session’s HKLiveWorkoutBuilder object, and implement its workoutBuilder(_:didCollectDataOf:) method.

See Also

Creating a live data source