How can I compare dates within the predicate ? Currently I get "Global functions are not supported in this predicate" error
filter: #Predicate<Flashcard> { $0.nextReviewAt <= Date.now },
class Flashcard {
var nextReviewAt: Date
}
How can I compare dates within the predicate ? Currently I get "Global functions are not supported in this predicate" error
filter: #Predicate<Flashcard> { $0.nextReviewAt <= Date.now },
class Flashcard {
var nextReviewAt: Date
}
Use predicate as a static function
filter: predicate(),
static func predicate() -> Predicate<Flashcard> {
let now = Date()
return #Predicate<Flashcard> { $0.nextReviewAt <= now }
}