---
title: "init(type:dateIssued:expirationDate:device:metadata:)"
framework: healthkit
role: symbol
role_heading: Initializer
path: "healthkit/hkvisionprescription/init(type:dateissued:expirationdate:device:metadata:)"
---

# init(type:dateIssued:expirationDate:device:metadata:)

Creates a new vision prescription sample.

## Declaration

```swift
convenience init(type: HKVisionPrescriptionType, dateIssued: Date, expirationDate: Date?, device: HKDevice?, metadata: [String : Any]?)
```

## Parameters

- `type`: A value that indicates the type of prescription. For a list of possible values, see doc://com.apple.healthkit/documentation/HealthKit/HKVisionPrescriptionType.
- `dateIssued`: The date when the doctor issued the prescription.
- `expirationDate`: The date when the prescription expires.
- `device`: The device that generated the sample.
- `metadata`: Additional metadata about the sample.

## Discussion

Discussion Use this initializer to create an image-only prescription. Here, you attach the prescription as an image or PDF to a simple sample. The sample contains only basic information about the prescription, such as the issue and expiration dates. To see the prescription data, people must view the attached image or PDF. To create a vision prescription sample that contains the full data for the prescription, use HKGlassesPrescription or HKContactsPrescription instead.

## See Also

### Related Documentation

- [HKGlassesPrescription](healthkit/hkglassesprescription.md)
- [HKContactsPrescription](healthkit/hkcontactsprescription.md)
