apple / sample-cloudkit-coredatasync

MIT License
190 stars 17 forks source link

Sorting not supporting Localized #2

Open MartinAtElitappar opened 2 years ago

MartinAtElitappar commented 2 years ago

Hi, I am from Europe, Sweden. I have struggled with the FetchRequest and sorting, because the project not support localized sort order. After som research I found a solution that I wan´t to share with you.

@FetchRequest(
        sortDescriptors: [NSSortDescriptor(key: "name", ascending: true, selector: #selector(NSString.localizedStandardCompare(_:)))],
        animation: .default)

I would like to thanks Keith Harrison for his article "Configuring SwiftUI Fetch Requests" and all the amazing news about SwiftUI and Dynamic Configuration in IOS 15.