Type Method

categoryType(forIdentifier:)

Returns the shared category type for the provided identifier.

Declaration

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

Parameters

identifier

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

Return Value

The shared HKCategoryType instance based on the provided identifier.

Discussion

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

Used to define the identifiers that create category type objects.