NSSortDescriptor in Swift

前端 未结 7 1658
长情又很酷
长情又很酷 2021-02-02 01:18

I am working on an iOS app and I have data stored in CoreData that I am loading into a UITableView. The data entities have an attribute called id which is a string

7条回答
  •  天涯浪人
    2021-02-02 01:49

    Swift 3

    let sortDescriptor = NSSortDescriptor(key: "id", ascending: true, selector: #selector(NSString.localizedCaseInsensitiveCompare))

    hope it helps

提交回复
热议问题