---
title: HKVisionPrism
framework: healthkit
role: symbol
role_heading: Class
path: healthkit/hkvisionprism
---

# HKVisionPrism

Prescription data for eye alignment.

## Declaration

```swift
class HKVisionPrism
```

## Overview

Overview To include prism information in a glasses prescription, start by creating an HKVisionPrism object. // The correction for eye alignment. let prismQuantity = HKQuantity(unit: .prismDiopter(), doubleValue: +0.25) let angle = HKQuantity(unit: .degreeAngle(), doubleValue: 15.0) let prism = HKVisionPrism(amount: prismQuantity,                           angle: angle,                           eye: .right) Then, pass this value to the HKGlassesLensSpecification’s initializer. // The prescription for the right eye. let glassesRightEye = HKGlassesLensSpecification(sphere: sphere,                                                  cylinder: cylinder,                                                  axis: axis,                                                  addPower: addPower,                                                  vertexDistance: vertexDistance,                                                  prism: prism,                                                  farPupillaryDistance: farDistance,                                                  nearPupillaryDistance: nearDistance) Finally, create the glasses prescription and save it to the HealthKit store. // The glasses prescription. let prescription = HKGlassesPrescription(rightEyeSpecification: glassesRightEye,                                                leftEyeSpecification: glassesLeftEye,                                                dateIssued: dateIssued,                                                expirationDate: expirationDate,                                                device: HKDevice.local(),                                                metadata: nil) // Save the sample to the HealthKit store. do {     try await store.save(prescription) } catch {     // Handle the error here.     fatalError("*** An error occurred while saving the prescription sample to the HealthKit store \(error.localizedDescription) ***") }

## Topics

### Creating vision prism objects

- [init(amount:angle:eye:)](healthkit/hkvisionprism/init(amount:angle:eye:).md)
- [init(verticalAmount:verticalBase:horizontalAmount:horizontalBase:eye:)](healthkit/hkvisionprism/init(verticalamount:verticalbase:horizontalamount:horizontalbase:eye:).md)

### Accessing lens specification data

- [eye](healthkit/hkvisionprism/eye.md)
- [HKVisionEye](healthkit/hkvisioneye.md)
- [amount](healthkit/hkvisionprism/amount.md)
- [angle](healthkit/hkvisionprism/angle.md)
- [horizontalAmount](healthkit/hkvisionprism/horizontalamount.md)
- [horizontalBase](healthkit/hkvisionprism/horizontalbase.md)
- [verticalAmount](healthkit/hkvisionprism/verticalamount.md)
- [verticalBase](healthkit/hkvisionprism/verticalbase.md)
- [HKPrismBase](healthkit/hkprismbase.md)

### Initializers

- [init(coder:)](healthkit/hkvisionprism/init(coder:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.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)
- [HKPrescriptionType](healthkit/hkprescriptiontype.md)
