<!--
{
  "documentType" : "article",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/samples",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Samples"
}
-->

# Samples

Create and save health and fitness samples.

## Discussion

The HealthKit store saves most health and fitness data using [`HKSample`](/documentation/HealthKit/HKSample) subclasses. All sample subclasses record information at a specified time. If the sample’s [`startDate`](/documentation/HealthKit/HKSample/startDate) and [`endDate`](/documentation/HealthKit/HKSample/endDate) properties are the same, the sample represents a point in time. If the [`endDate`](/documentation/HealthKit/HKSample/endDate) is after the [`startDate`](/documentation/HealthKit/HKSample/startDate), the sample represents a time interval.

HealthKit uses different [`HKSample`](/documentation/HealthKit/HKSample) subclasses to store different types of data:

- [`HKQuantitySample`](/documentation/HealthKit/HKQuantitySample) objects store quantities—a numerical value and units. Most HealthKit data types use quantity samples. For example, height, heart rate, and dietary energy consumed all use quantity samples.
- [`HKCategorySample`](/documentation/HealthKit/HKCategorySample) objects store a single option selected from a short list. For example, category samples record sleep data (the user can be in bed, asleep, or awake).
- [`HKCorrelation`](/documentation/HealthKit/HKCorrelation) samples combine two or more samples into a single value. For example, correlation samples represent food intake and blood pressure samples. A food sample contains any number of nutrition samples, while a blood pressure sample contains both a systolic and a diastolic sample.
- HealthKit represents specialized data types with sample subclasses such as [`HKCDADocumentSample`](/documentation/HealthKit/HKCDADocumentSample), [`HKWorkoutRoute`](/documentation/HealthKit/HKWorkoutRoute), and [`HKWorkout`](/documentation/HealthKit/HKWorkout).

## Topics

### Essentials

  <doc://com.apple.healthkit/documentation/HealthKit/saving-data-to-healthkit>

  <doc://com.apple.healthkit/documentation/HealthKit/reading-and-writing-healthkit-series-data>

### Basic samples

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

A sample that represents a cumulative quantity.

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

A sample that represents a discrete quantity.

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

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

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

A sample with values from a short list of possible values.

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

A sample that groups multiple related samples into a single entry.

  <doc://com.apple.healthkit/documentation/HealthKit/units-and-quantities>

  <doc://com.apple.healthkit/documentation/HealthKit/metadata-keys>

### Series data

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

A builder object for incrementally building a sample that contains multiple quantities.

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

A builder object for incrementally building a heartbeat series.

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

A sample that represents a series of heartbeats.

### Electrocardiograms

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

A sample for electrocardiogram data.

[`VoltageMeasurement`](/documentation/HealthKit/HKElectrocardiogram/VoltageMeasurement)

The voltage for all leads at a single point in time.

### Audiograms

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

A sample that stores an audiogram.

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

A hearing sensitivity reading associated with a hearing test.

### Medical records

  <doc://com.apple.healthkit/documentation/HealthKit/accessing-health-records>

  <doc://com.apple.healthkit/documentation/HealthKit/accessing-sample-data-in-the-simulator>

  <doc://com.apple.healthkit/documentation/HealthKit/accessing-a-user-s-clinical-records>

  <doc://com.apple.healthkit/documentation/HealthKit/accessing-data-from-a-smart-health-card>

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

A sample that stores a clinical record.

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

An object containing Fast Healthcare Interoperability Resources (FHIR) data.

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

A sample that represents the contents of a SMART Health Card or EU Digital COVID Certificate.

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

The subject associated with a signed clinical record.

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

A Clinical Document Architecture (CDA) sample that stores a single document.

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

An abstract class that represents a health document in the HealthKit store.

[`HKDocumentTypeIdentifierCDA`](/documentation/HealthKit/HKDocumentTypeIdentifier/CDA)

The CDA Document type identifier, used when requesting permission to read or share CDA documents.

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

A sample type used to create queries for documents.

### Vision prescriptions

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

A sample that stores a vision prescription.

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

A sample that stores a prescription for glasses.

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

A sample that store a prescription for contacts.

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

An object that contains the glasses prescription data for one eye.

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

An object that contains the contacts prescription data for one eye.

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

An abstract superclass for lens specifications.

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

Prescription data for eye alignment.

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

A type that identifies samples that store a prescription.

### Walking steadiness classifications

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

A classification of a score based on the steadiness of the user’s gait.

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

Provides a classification for a score that measures the steadiness of the user’s gait.

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

Returns the maximum score for the steadiness of the user’s gait based on the provided classification.

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

Returns the minimum score for the steadiness of the user’s gait based on the provided classification.

### Attachments

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

A file that is attached to a sample in the HealthKit store.

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

The access point for attachments associated with samples in the HealthKit store.

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

A reader that provides access to an attachment’s data.

### Digital signatures

  <doc://com.apple.healthkit/documentation/HealthKit/adding-digital-signatures>

### Abstract superclasses

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

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

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

A HealthKit sample represents a piece of data associated with a start and end time.

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

A piece of data that can be stored inside the HealthKit store.

### Deprecated classes

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

A sample representing a series of cumulative quantity values.



---

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)