I am working on an iOS app and I have data stored in CoreData that I am loading into a UITableView. The data entities have an attribute called id which is a string
id
for swift 4.2
You can sort array using NSSortDescriptor
NSSortDescriptor
let descriptor: NSSortDescriptor = NSSortDescriptor(key: "lastMessageDate", ascending: false) let sortedResults = arrChatDialogs?.sortedArray(using: [descriptor])