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

# quantityType(forIdentifier:)

Returns the shared quantity type for the provided identifier.

## Declaration

```swift
class func quantityType(forIdentifier identifier: HKQuantityTypeIdentifier) -> HKQuantityType?
```

## Parameters

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

## Mentioned in

Saving data to HealthKit

## Return Value

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

## Discussion

Discussion This method returns an instance of the HKQuantityType concrete subclass. HealthKit uses quantity types to create samples that store a numerical value. Use quantity type instances to create quantity samples that you can save in the HealthKit store. For more information, see HKQuantitySample.

## See Also

### Creating quantity types

- [HKQuantityTypeIdentifier](healthkit/hkquantitytypeidentifier.md)
