swift闭包排序算法
2017-04-18 本文已影响0人
彧哥哥
let names = ["Chirs", "Alex", "Ewa", "中国", "美国", "啊", "把", "Barry", "Daniella"]
func backwards(s1: String, s2: String) ->Bool {
return s1 > s2
}
let reversed = names.sorted(by: backwards)
print(reversed)