I have a Core Data item called an expense, which has different properties such as
expense.name
expense.amount
and also
expense.modificationDate
I have an array, which is of type expenses, and I want to sort the array. I have tried this so far
monthlyExpenses.sort(by: { $0.modificationDate?.compare($1.modificationDate! as Date) == .orderedAscending })
but it doesn't seem to work. How can I get this to work?