Type Method


Returns the shared quantity type for the provided identifier.


class func quantityType(forIdentifier identifier: HKQuantityTypeIdentifier) -> HKQuantityType?



A quantity type identifier. For a list of valid identifiers, see HKQuantityTypeIdentifier.

Return Value

The shared HKQuantityType instance based on the provided identifier.


This method returns an instance of the HKQuantityType concrete subclass. HealthKit uses quantity types to create samples that store a numerical value. Use quantity type instances to create quantity samples that you can save in the HealthKit store. For more information, see HKQuantitySample.

See Also

Creating Quantity Types

struct HKQuantityTypeIdentifier

Used to define the identifiers that create quantity type objects.