1
如何根据土耳其语排序fetchResult,在结果结尾处排序土耳其字符。土耳其语区域的Swift排序FetchRequest结果
let managedObjectContext = (UIApplication.shared.delegate as! AppDelegate).managedObjectContext
let fetch = NSFetchRequest<Contact>(entityName: "Contact")
let sortDescriptor = NSSortDescriptor(key: "firstName", ascending: true)
let sortDescriptors = [sortDescriptor]
fetch.sortDescriptors = sortDescriptors
do {
let list = try managedObjectContext.fetch(fetch)
} catch {
fatalError("Failed \(error)")
}
我发现溶液通过改变NSSortDescriptor(标号: “名字”,上升:真)至NSSortDescriptor(标号: “名字”,上升:真,选择器:#selector (NSString.localizedCaseInsensitiveCompare))。 – oburan
如果您可以发布您找到的解决方案作为答案,这样会很好,这样搜索的其他人就可以获得帮助。 – Sneha