更新时间:2023-01-29 08:28:33
如果要过滤所选日中的记录,则必须应用带有开始日期和结束日期的谓词>
If you want to filter the records which are in the selected day you have to apply a predicate with start and end date
let startDate = Calendar.current.startOfDay(for: calendar.selectedDate)
let endDate = Calendar.current.date(byAdding: .day, value: 1, to: startDate)
let predicate = NSPredicate(format: "date >= %@ AND date < %@", startDate as NSDate, endDate as NSDate)