Type Method

quantityType(forIdentifier:)

Returns the shared quantity type for the provided identifier.

Declaration

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

Parameters

identifier

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

Return Value

The shared HKQuantityType instance based on the provided identifier.

Discussion

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.