visionPrescription(_:)
Returns a predicate that matches prescription samples.
Declaration
static func visionPrescription(_ predicate: NSPredicate? = nil) -> HKSamplePredicate<HKVisionPrescription>Parameters
- predicate:
A predicate that further filters the matching prescriptions.
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)