<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKVisionPrism",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKVisionPrism"
  },
  "title" : "HKVisionPrism"
}
-->

# HKVisionPrism

Prescription data for eye alignment.

```
class HKVisionPrism
```

## Overview

To include prism information in a glasses prescription, start by creating an [`HKVisionPrism`](/documentation/HealthKit/HKVisionPrism) object.

```swift
// 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`](/documentation/HealthKit/HKGlassesLensSpecification)’s initializer.

```swift
// 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.

```swift
// 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: HKQuantity, angle: HKQuantity, eye: HKVisionEye)`](/documentation/HealthKit/HKVisionPrism/init(amount:angle:eye:))

Creates a new vision prism object, using a single quantity and an alignment angle.

[`init(verticalAmount: HKQuantity, verticalBase: HKPrismBase, horizontalAmount: HKQuantity, horizontalBase: HKPrismBase, eye: HKVisionEye)`](/documentation/HealthKit/HKVisionPrism/init(verticalAmount:verticalBase:horizontalAmount:horizontalBase:eye:))

Creates a new vision prism object that separates the correction strength into horizontal and vertical components.

### Accessing lens specification data

[`var eye: HKVisionEye`](/documentation/HealthKit/HKVisionPrism/eye)

A value indicating which eye the correction applies to.

[`enum HKVisionEye`](/documentation/HealthKit/HKVisionEye)

A value that specifies the eye for a vision prescription.

[`var amount: HKQuantity`](/documentation/HealthKit/HKVisionPrism/amount)

The strength of the correction.

[`var angle: HKQuantity`](/documentation/HealthKit/HKVisionPrism/angle)

The orientation of the adjustment.

[`var horizontalAmount: HKQuantity`](/documentation/HealthKit/HKVisionPrism/horizontalAmount)

The strength of the horizontal correction.

[`var horizontalBase: HKPrismBase`](/documentation/HealthKit/HKVisionPrism/horizontalBase)

The orientation of the horizontal portion of the correction.

[`var verticalAmount: HKQuantity`](/documentation/HealthKit/HKVisionPrism/verticalAmount)

The strength of the vertical correction.

[`var verticalBase: HKPrismBase`](/documentation/HealthKit/HKVisionPrism/verticalBase)

The orientation of the vertical portion of the correction.

[`enum HKPrismBase`](/documentation/HealthKit/HKPrismBase)

The orientation of the prism correction, represented by the location of the prism’s base (the thickest part of the prism).

### Initializers

[`init?(coder: NSCoder)`](/documentation/HealthKit/HKVisionPrism/init(coder:))

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

[`Hashable`](/documentation/Swift/Hashable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Equatable`](/documentation/Swift/Equatable)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)