Type Method


Returns the shared category type for the provided identifier.


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



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

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.

See Also

Creating Category Types

struct HKCategoryTypeIdentifier

Identifiers for creating category types.