Can’t pass Date to NSPredicate(format: …) without “as CVarArg”

The %@ format expect a Foundation object as argument, compare
“Predicate Format String Syntax” in the “Predicate Programming Guide”.

Therefore you have to cast the overlay type Date back to its Foundation
counterpart NSDate:

let endDate = Date()
let pred = NSPredicate(format: "endDate == %@", endDate as NSDate)

Leave a Comment