Quantity types identify samples that store numerical values.


The HKQuantityType class is a concrete subclass of the HKObjectType class. To create a quantity type instance, use the object type’s quantityType(forIdentifier:) convenience method.

Use quantity types to:

  • Request permission to read or write matching quantity samples.

  • Create and share matching quantity samples.

  • Query for matching quantity samples.


Accessing Quantity Type Data

var aggregationStyle: HKQuantityAggregationStyle

The aggregation style for the given quantity type.

enum HKQuantityAggregationStyle

Constant values that describe how quantities can be aggregated over time.

func `is`(compatibleWith: HKUnit)

Returns a Boolean value that indicates whether the quantity type is compatible with the given unit.


Inherits From

Conforms To

See Also

Type Objects

class HKCharacteristicType

Characteristic types represent data that does not typically change over time.

class HKCategoryType

Category types identify samples that contain a value from a small set of possible values.

class HKCorrelationType

Correlation types identify samples that group multiple subsamples.

class HKActivitySummaryType

Activity summary types identify activity summary objects.

class HKSeriesType

An identifier that indicates the type for data stored in a series sample.

class HKObjectType

The abstract superclass for all classes that identify a specific type of data when working with the HealthKit store.

class HKSampleType

An abstract superclass for all classes that identify a specific type of sample when working with the HealthKit store.