Type Method

quantityType(forIdentifier:)

Returns the shared HKQuantityType object 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 HealthKit Constants.

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 Subclasses

class func categoryType(forIdentifier: HKCategoryTypeIdentifier)

Returns the shared HKCategoryType object for the provided identifier.

class func characteristicType(forIdentifier: HKCharacteristicTypeIdentifier)

Returns the shared HKCharacteristicType object for the provided identifier.

class func documentType(forIdentifier: HKDocumentTypeIdentifier)

Returns the shared HKDocumentType object for the provided identifier.

class func workoutType()

Returns the shared HKWorkoutType object.