拼音排序
let locale = Locale(identifier: "zh@collation=pinyin")
let pinyinSorted = nameList.sorted {
$0.compare($1, locale: locale) == .orderedAscending
}
注音排序
let localeZhuyin = Locale(identifier: "zh@collation=zhuyin")
let zhuyinSorted = nameList.sorted {
$0.compare($1, locale: localeZhuyin) == .orderedAscending
}
笔画排序
let localeStroke = Locale(identifier: "zh@collation=stroke")
let strokeSorted = nameList.sorted {
$0.compare($1, locale: localeStroke) == .orderedAscending
}