Reputation: 39
let dateSort = NSSortDescriptor(key: "created", ascending: false)
fetchRequest.sortDescriptors = [dateSort]
I think [dateSort] is array transformation of NSSortDescriptor object. (If not, please tell me what it is.) So why does sortDescriptors take the array of NSSortDescriptor, not just single NSSortDescriptor?
Upvotes: 0
Views: 100
Reputation: 318884
You pass an array of sort descriptors because you can provide multiple levels of sorts. If the first level compares equal, the next level is checked. This continues for as many sort levels as you specify.
Upvotes: 2
Reputation: 508
It is an array transformation of NSSortDescriptor object. It's trying to allow you to sort using multiple criteria.
Upvotes: 0