Contents

HKPrescriptionType

A type that identifies samples that store a prescription.

Declaration

class HKPrescriptionType

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) ***")
    }
}

See Also

Vision prescriptions