<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKQuantityType",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKQuantityType"
  },
  "title" : "HKQuantityType"
}
-->

# HKQuantityType

A type that identifies samples that store numerical values.

```
class HKQuantityType
```

## Overview

The [`HKQuantityType`](/documentation/HealthKit/HKQuantityType) class is a concrete subclass of the [`HKObjectType`](/documentation/HealthKit/HKObjectType) class. To create a quantity type instance, use the object type’s [`quantityType(forIdentifier:)`](/documentation/HealthKit/HKObjectType/quantityType(forIdentifier:)) convenience method.

Use quantity types to:

- Request permission to read or write matching quantity samples.
- Create and share matching quantity samples.
- Query for matching quantity samples.

## Topics

### Creating Quantity Types

[`init(_:)`](/documentation/HealthKit/HKQuantityType/init(_:))

Creates a quantity type using the provided identifier.

### Accessing Quantity Type Data

[`aggregationStyle`](/documentation/HealthKit/HKQuantityType/aggregationStyle)

The aggregation style for the given quantity type.

[`HKQuantityAggregationStyle`](/documentation/HealthKit/HKQuantityAggregationStyle)

Constant values that describe how quantities can be aggregated over time.

[`is(compatibleWith:)`](/documentation/HealthKit/HKQuantityType/is(compatibleWith:))

Returns a Boolean value that indicates whether the quantity type is compatible with the given unit.

## See Also

[`HKQuantityTypeIdentifier`](/documentation/HealthKit/HKQuantityTypeIdentifier)

The identifiers that create quantity type objects.

[`HKQuantitySample`](/documentation/HealthKit/HKQuantitySample)

A sample that represents a quantity, including the value and the units.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)