I have an entity in core data that stores a Date property date. I have an @State property in my View selectedDate that is of type Date.
I want to use a fetch request to retrieve all of the entities in the database with a date matching selectedDate. I want to do this exclusive of the time; for example selectedDate could be 15/03/2022 at 12:07pm, and date could be 15/03/2022 at 9:05am - I would like these to be matched.
I have tried to use the following (although this will not achieve the desired time behaviour):
request.predicate = NSPredicate(format: "date == %@", selectedDate.timeIntervalSince1970)
However, when running the app I get the following error, on the predicate line:
Thread 1: EXC_BAD_ACCESS (code=1, address=0x41d88c207fdc4b4d)
Does anyone know how to do this?