---
title: "categoryType(forIdentifier:)"
framework: healthkit
role: symbol
role_heading: Type Method
path: "healthkit/hkobjecttype/categorytype(foridentifier:)"
---

# categoryType(forIdentifier:)

Returns the shared category type for the provided identifier.

## Declaration

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

## Parameters

- `identifier`: A category type identifier. For a list of valid identifiers, see doc://com.apple.healthkit/documentation/HealthKit/HKCategoryTypeIdentifier.

## Return Value

Return Value The shared HKCategoryType instance based on the provided identifier.

## Discussion

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

- [HKCategoryTypeIdentifier](healthkit/hkcategorytypeidentifier.md)
