Type Method


Returns the shared HKCategoryType object for the provided identifier.


class func categoryType(forIdentifier identifier: HKCategoryTypeIdentifier) -> HKCategoryType?



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

Return Value

The shared HKCategoryType instance based on the provided identifier.


This method returns an instance of the HKCategoryType concrete subclass. HealthKit uses category types to represent data that can be categorized into an enumeration of values. Use category type instances to create category samples that you can then save in the HealthKit store. For more information, see HKCategorySample.

HealthKit provides only a single category type: sleep analysis.

See Also

Creating Subclasses

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 quantityType(forIdentifier: HKQuantityTypeIdentifier)

Returns the shared HKQuantityType object for the provided identifier.

class func workoutType()

Returns the shared HKWorkoutType object.