I have been trying to sort RLMResults by 2 properties, 1st is sort value and 2nd is name, but no luck. I am getting wrong results when I try to sort with 2 properties.
What I want is I want to sort results using sort value and then alphabetically.
self.allTasks = [[[Task allObjects]
sortedResultsUsingProperty:@"priorityLevelSortValue" ascending:YES]
sortedResultsUsingProperty:@"taskName" ascending:YES];
Any help would be much appreciable.
Thank you.
Use -[RLMResults sortedResultsUsingDescriptors:]
to sort by multiple properties:
[[Task allObjects] sortedResultsUsingDescriptors:@[
[RLMSortDescriptor sortDescriptorWithProperty:@"priorityLevelSortValue" ascending:YES],
[RLMSortDescriptor sortDescriptorWithProperty:@"taskName" ascending:YES]
]];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With