Contents

HKDiscreteQuantitySample

A sample that represents a discrete quantity.

Declaration

class HKDiscreteQuantitySample

Mentioned in

Overview

A quantity sample contains one or more HKQuantity objects. Each quantity represents a single piece of data with a single numeric value and the value’s associated units. Use these samples to store data representing independent measurements, such as height, heart rate, or temperature.

The HKDiscreteQuantitySample class is a concrete subclass of the HKQuantitySample class. Discrete quantity samples are immutable; you set the sample’s properties when you create it, and they cannot change.

Extend Discrete Quantity Samples

Like many HealthKit classes, you should not subclass the HKDiscreteQuantitySample class. You may extend this class by adding metadata with custom keys to save related data used by your app.

For more information, see init(type:quantity:start:end:metadata:).

Topics

Accessing Calculated Values

Specifying Predicate Key Paths

See Also

Basic samples