I have an array of objects that has a member that is type Date, and I'm trying to sort the whole array by Date, and it's not sorting correctly.
This is the code I'm using, the name of the array is alarms and the name of the member type Date is time.
alarms.sort(by: { $0.time.compare($1.time) == .orderedAscending })
and whenever I sort it it just doesn't work correctly, and I'm testing it by printing all the values in a for loop.
Can someone help me with the syntax for this?
Datedoesn't have atimeproperty. Where does this come from?timeis the name of aDateproperty of his alarm type.