---
title: "documentType(forIdentifier:)"
framework: healthkit
role: symbol
role_heading: Type Method
path: "healthkit/hkobjecttype/documenttype(foridentifier:)"
---

# documentType(forIdentifier:)

Returns the shared document type for the provided identifier.

## Declaration

```swift
class func documentType(forIdentifier identifier: HKDocumentTypeIdentifier) -> HKDocumentType?
```

## Parameters

- `identifier`: A document type identifier. For a list of valid identifiers, see doc://com.apple.healthkit/documentation/HealthKit/HKDocumentTypeIdentifier.

## Return Value

Return Value The shared HKDocumentType instance based on the provided identifier.

## Discussion

Discussion This method returns an instance of the HKQuantityType concrete subclass. HealthKit uses document types to manage medical documents. Use document type instances to create document samples that you can save in the HealthKit store. For more information, see HKDocumentSample.

## See Also

### Creating document types

- [HKDocumentTypeIdentifier](healthkit/hkdocumenttypeidentifier.md)
