---
title: HKPrescriptionType
framework: healthkit
role: symbol
role_heading: Class
path: healthkit/hkprescriptiontype
---

# HKPrescriptionType

A type that identifies samples that store a prescription.

## Declaration

```swift
class HKPrescriptionType
```

## Overview

Overview The HKPrescriptionType class is a concrete subclass of the HKSampleType class. To create a vision prescription type instances, use the visionPrescriptionType() convenience method. Use this data type to request permission to save vision prescriptions to the HealthKit store. // Create the prescription data type. let visionPrescriptionType = HKObjectType.visionPrescriptionType()

// Request authorization to save vision prescription samples. store.requestAuthorization(toShare: [visionPrescriptionType],                            read: []) { success, error in     if let error {         // Handle errors here.         fatalError("*** An error occurred while requesting permission: \(error.localizedDescription) ***")     } } note: Important Vision prescription samples require per-object authorization. Requesting authorization to read these samples using requestAuthorization(toShare:read:) fails with an error. Instead, use requestPerObjectReadAuthorization(for:predicate:completion:) to request authorization before querying for samples.

## Relationships

### Inherits From

- [HKSampleType](healthkit/hksampletype.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)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Vision prescriptions

- [HKVisionPrescription](healthkit/hkvisionprescription.md)
- [HKGlassesPrescription](healthkit/hkglassesprescription.md)
- [HKContactsPrescription](healthkit/hkcontactsprescription.md)
- [HKGlassesLensSpecification](healthkit/hkglasseslensspecification.md)
- [HKContactsLensSpecification](healthkit/hkcontactslensspecification.md)
- [HKLensSpecification](healthkit/hklensspecification.md)
- [HKVisionPrism](healthkit/hkvisionprism.md)
