---
title: HKCumulativeQuantitySample
framework: healthkit
role: symbol
role_heading: Class
path: healthkit/hkcumulativequantitysample
---

# HKCumulativeQuantitySample

A sample that represents a cumulative quantity.

## Declaration

```swift
class HKCumulativeQuantitySample
```

## Mentioned in

Accessing condensed workout samples

## Overview

Overview A quantity sample contains one or more HKQuantity objects. Each quantity represents a single piece of data with a single numeric value and the value’s associated units. Use these samples to store data that accumulates over time, such as step count, active energy burned, or walking distance. The HKCumulativeQuantitySample class is a concrete subclass of the HKQuantitySample class. Cumulative quantity samples are immutable; you set the sample’s properties when you create it, and they cannot change. Extend Cumulative Quantity Samples Like many HealthKit classes, you should not subclass the HKCumulativeQuantitySample class. You may extend this class by adding metadata with custom keys to save related data used by your app. For more information, see init(type:quantity:start:end:metadata:).

## Topics

### Accessing Calculated Data

- [sumQuantity](healthkit/hkcumulativequantitysample/sumquantity.md)

## Relationships

### Inherits From

- [HKQuantitySample](healthkit/hkquantitysample.md)

### Inherited By

- [HKCumulativeQuantitySeriesSample](healthkit/hkcumulativequantityseriessample.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Basic samples

- [HKDiscreteQuantitySample](healthkit/hkdiscretequantitysample.md)
- [HKQuantitySample](healthkit/hkquantitysample.md)
- [HKCategorySample](healthkit/hkcategorysample.md)
- [HKCorrelation](healthkit/hkcorrelation.md)
- [Units and quantities](healthkit/units-and-quantities.md)
- [Metadata Keys](healthkit/metadata-keys.md)
