Swift Selector caseInsensitiveCompare

时间:2014-06-15 10:58:06

标签: arrays sorting selector swift

的代码如何?
@selector(caseInsensitiveCompare:)
在斯威夫特? 我尝试对字典数组

进行排序
 NSSortDescriptor(key: "name", ascending: true, selector: Selector(???))

由于

1 个答案:

答案 0 :(得分:6)

Swift 3

NSSortDescriptor(key: "name", ascending: true, selector: #selector(NSString.caseInsensitiveCompare(_:)))

Swift 2

NSSortDescriptor(key: "name", ascending: true, selector: "caseInsensitiveCompare:")