Type Method

characteristicType(forIdentifier:)

Returns the shared HKCharacteristicType object for the provided identifier.

Declaration

class func characteristicType(forIdentifier identifier: HKCharacteristicTypeIdentifier) -> HKCharacteristicType?

Parameters

identifier

A characteristic type identifier. For a list of valid identifiers, see HealthKit Constants.

Return Value

The shared HKCharacteristicType instance based on the provided identifier.

Discussion

This method returns an instance of the HKCharacteristicType concrete subclass. Characteristic types represent data that doesn’t typically change over time. Unlike the other object types, characteristic types cannot be used to create new HealthKit objects. Instead, users must enter and edit their characteristic data using the Health app. Characteristic types are used only when asking for permission to read data from the HealthKit store.

HealthKit defines four characteristic type identifiers: biologicalSex, bloodType, dateOfBirth, and fitzpatrickSkinType.

See Also

Creating Subclasses

class func categoryType(forIdentifier: HKCategoryTypeIdentifier)

Returns the shared HKCategoryType object for the provided identifier.

class func documentType(forIdentifier: HKDocumentTypeIdentifier)

Returns the shared HKDocumentType object for the provided identifier.

class func quantityType(forIdentifier: HKQuantityTypeIdentifier)

Returns the shared HKQuantityType object for the provided identifier.

class func workoutType()

Returns the shared HKWorkoutType object.