Your sorting syntax works (almost) if you are using a custom struct rather than a dictionary
struct Person {
let name : String
let age : Int
}
let unsortedPeople = [Person(name:"Bill", age:20), Person(name:"Amy", age:20)]
Now you can use the sorted
function
let sortedDict = unsortedPeople.sorted{ $0.name < $1.name }
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…