Sort results is different between realm sort and Swift sort #8451
Labels
More-information-needed
More information is needed to progress. The issue will close automatically in 2 weeks.
O-Community
Waiting-For-Reporter
Waiting for more information from the reporter before we can proceed
i am using realmSwift, to cater the requirement, i will sort this result for display, when i sort it using sorted(by:) in realm and sorted() in swift, found that the results is different. The sort keyword is a property of the object type String.
func sortInventories(inventories: Results, by preference: SortingPreference) {
var sortDescriptors = RealmSwift.SortDescriptor
sortDescriptors.append(.init(keyPath: \Inventory.brandName))
var arr = Array(inventories).sorted { s, ss in
return s.brandName < ss.brandName
}
var xx = inventories.sorted(by: sortDescriptors)
}
The text was updated successfully, but these errors were encountered: