I am trying to use SwiftData for an application I was using CoreData for. When I specify a sort order based on a String type, it gives me a list sorted with case-sensitivity:
If my model looks like:
import SwiftData
@Model
final class Item {
var name: String
init(name: String) {
self.name = name
}
}
Then in my view at the top, I do:
struct ContentView: View {
@Environment(\.modelContext) private var modelContext
@Query(sort: \.name) private var items: [Item]
If my data has the following in it: ["a", "B", "C"], Items will come back in the order ["B", "C", "a"].
How do I get SwiftData to sort without case-sensitivity?