Case Insensitive Compare with Core Data and Swift

时光毁灭记忆、已成空白 提交于 2019-12-05 02:49:35

The selector is caseInsensitiveCompare:, with the colon, and you can use it with Core Data.

The colon is there because the method (which is an instance method of NSString) takes one argument (the string to compare with).

As list of sort selectors which can be used with Core Data and a SQLite store can be found in Persistent Store Types and Behaviors in the Core Data Programming Guide.

gowthaman-mallow

Swift 3 - 5.0 Syntax

let sortDescriptor = NSSortDescriptor(key: "KeyName", ascending: true, selector: #selector(NSString.caseInsensitiveCompare))
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!