The HKDocumentSample class is an abstract class that represents a health document in the HealthKit store.


class HKDocumentSample : HKSample


You should never instantiate an HKDocumentSample object directly. Instead, you always work with a concrete subclass. In iOS 10 and watchOS 3, the only concrete class is the HKCDADocumentSample class.

Document samples are immutable: You set the sample’s properties when you create it, and they cannot change.

Subclassing Notes

Like many HealthKit classes, you should not create any custom subclasses of the HKDocumentSample class. You can extend the HKDocumentSample class and its subclasses by adding custom metadata keys and values to the metadata dictionary when the object is instantiated.


Accessing the Document Sample Properties

var documentType: HKDocumentType

The type of document represented by the sample.


Inherits From

Conforms To

See Also

Medical Records

Accessing Health Records

Read clinical record data from the HealthKit store.

Accessing Sample Data in the Simulator

Set up sample accounts to build and test your app.

Accessing a User’s Clinical Records

Display a user’s clinical records by requesting authorization and querying HealthKit for the records.

class HKClinicalRecord

A sample that stores a clinical record.

class HKFHIRResource

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

class HKCDADocumentSample

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

static let CDA: HKDocumentTypeIdentifier

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

class HKDocumentType

The HKDocumentType class is a concrete subclass of the HKSampleType class, used when creating queries for documents.