---
title: "visionPrescription(_:)"
framework: healthkit
role: symbol
role_heading: Type Method
path: "healthkit/hksamplepredicate/visionprescription(_:)"
---

# visionPrescription(_:)

Returns a predicate that matches prescription samples.

## Declaration

```swift
static func visionPrescription(_ predicate: NSPredicate? = nil) -> HKSamplePredicate<HKVisionPrescription>
```

## Parameters

- `predicate`: A predicate that further filters the matching prescriptions.

## Discussion

Discussion Use this method to create a predicate that matches vision prescriptions. // Create a predicate that matches samples stored today. let end = Date() let start = Calendar.current.startOfDay(for: Date()) let datePredicate = HKQuery.predicateForSamples(withStart: start, end: end)

// Create a predicate that matches vision prescriptions samples stored today. let predicate = HKSamplePredicate.visionPrescription(datePredicate)

## See Also

### Creating Sample Predicates

- [audiogram(_:)](healthkit/hksamplepredicate/audiogram(_:).md)
- [categorySample(type:predicate:)](healthkit/hksamplepredicate/categorysample(type:predicate:).md)
- [clinicalRecord(type:predicate:)](healthkit/hksamplepredicate/clinicalrecord(type:predicate:).md)
- [correlation(type:predicate:)](healthkit/hksamplepredicate/correlation(type:predicate:).md)
- [electrocardiogram(_:)](healthkit/hksamplepredicate/electrocardiogram(_:).md)
- [heartbeatSeries(_:)](healthkit/hksamplepredicate/heartbeatseries(_:).md)
- [quantitySample(type:predicate:)](healthkit/hksamplepredicate/quantitysample(type:predicate:).md)
- [sample(type:predicate:)](healthkit/hksamplepredicate/sample(type:predicate:).md)
- [workout(_:)](healthkit/hksamplepredicate/workout(_:).md)
- [workoutRoute(_:)](healthkit/hksamplepredicate/workoutroute(_:).md)
