Answer the question
In order to leave comments, you need to log in
How to sort by date?
There is a list of customers, they have the name and date of orders, you need to output the table view cell by date .. that is, you need to sort when outputting to the table view sorting by the date value (zakazDate) in core data
Answer the question
In order to leave comments, you need to log in
func getData() {
let context = appDelegate.persistentContainer.viewContext
let fetchRequest = NSFetchRequest<Expenses>(entityName: "Expenses")
let sort = NSSortDescriptor(key: #keyPath(Expenses.date), ascending: true)
fetchRequest.sortDescriptors = [sort]
do {
expenses = try context.fetch(fetchRequest)
} catch {
print("Cannot fetch Expenses")
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question