最佳答案
I have an array of Contact
objects:
var contacts:[Contact] = [Contact]()
Contact class:
Class Contact:NSOBject {
var firstName:String!
var lastName:String!
}
And I would like to sort that array by lastName
and then by firstName
in case some contacts got the same lastName
.
I'm able to sort by one of those criteria, but not both.
contacts.sortInPlace({$0.lastName < $1.lastName})
How could I add more criteria to sort this array?