Hi. I have a model with basic info, a name and date and a few other things. I want to create a view that only shows objects where the date is “today” using SwiftData filter options.
I’ve done a lot of searches but all the results give older ways of changing the data format or something and I’m so new to coding I don’t know how to make the translation to a more current way of doing it. I even ran through the Apple “Getting Started with Today” tutorial but that is super old and uses a list style to filter.
The best I’ve come up with is:
init(sort: SortDescriptor<Task>, searchString: String) {
_tasks = Query(filter: #Predicate {
Calendar.current.isDateInToday($0.timestamp) }, sort: [sort])
}
But I’m getting an error “The isDateInToday( _: ) function is not supported in this predicate.”
Any suggests to filter a query for today?
Thank you.