---
title: HKCDADocumentSample
framework: healthkit
role: symbol
role_heading: Class
path: healthkit/hkcdadocumentsample
---

# HKCDADocumentSample

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

## Declaration

```swift
class HKCDADocumentSample
```

## Overview

Overview The sample’s document property contains an HKCDADocument object, representing the underlying XML document. The HKCDADocumentSample class is a concrete subclass of the HKDocumentSample class. Document samples are immutable. HealthKit assigns the document’s properties when the sample is created. They cannot change. If you need to update a document in HealthKit, create a new document sample with the updated CDA document.

## Topics

### Creating CDA Samples

- [init(data:start:end:metadata:)](healthkit/hkcdadocumentsample/init(data:start:end:metadata:).md)
- [HKDetailedCDAValidationErrorKey](healthkit/hkdetailedcdavalidationerrorkey.md)

### Accessing the Document

- [document](healthkit/hkcdadocumentsample/document.md)
- [HKCDADocument](healthkit/hkcdadocument.md)

### Accessing Validation Errors

- [HKDetailedCDAValidationErrorKey](healthkit/hkdetailedcdavalidationerrorkey.md)

### Specifying Predicate Key Paths

- [HKPredicateKeyPathCDAAuthorName](healthkit/hkpredicatekeypathcdaauthorname.md)
- [HKPredicateKeyPathCDACustodianName](healthkit/hkpredicatekeypathcdacustodianname.md)
- [HKPredicateKeyPathCDAPatientName](healthkit/hkpredicatekeypathcdapatientname.md)
- [HKPredicateKeyPathCDATitle](healthkit/hkpredicatekeypathcdatitle.md)

### Initializers

- [init(data:startDate:endDate:metadata:)](healthkit/hkcdadocumentsample/init(data:startdate:enddate:metadata:).md)

## Relationships

### Inherits From

- [HKDocumentSample](healthkit/hkdocumentsample.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

### Medical records

- [Accessing Health Records](healthkit/accessing-health-records.md)
- [Accessing Sample Data in the Simulator](healthkit/accessing-sample-data-in-the-simulator.md)
- [Accessing a User’s Clinical Records](healthkit/accessing-a-user-s-clinical-records.md)
- [Accessing Data from a SMART Health Card](healthkit/accessing-data-from-a-smart-health-card.md)
- [HKClinicalRecord](healthkit/hkclinicalrecord.md)
- [HKFHIRResource](healthkit/hkfhirresource.md)
- [HKVerifiableClinicalRecord](healthkit/hkverifiableclinicalrecord.md)
- [HKVerifiableClinicalRecordSubject](healthkit/hkverifiableclinicalrecordsubject.md)
- [HKDocumentSample](healthkit/hkdocumentsample.md)
- [CDA](healthkit/hkdocumenttypeidentifier/cda.md)
- [HKDocumentType](healthkit/hkdocumenttype.md)
