I am trying to fetch records from an Entity, the records are huge above 5000. So i want to fetch the records with alphabetically sorted(name paramter) instead of sorting with NSSortDescriptor on result array.
Is there any predicate we can place to fetech records alphabetically sorted.
Set the NSSortDecriptor
within your NSFetchRequest *fetchRequest
, like you would with any predicate
[fetchRequest setSortDescriptors:@[[[NSSortSDescriptor alloc] initWithKey:@"name parameter" ascending:YES]]];
This means your request is already sorted like you require as it's being fetched.
As Kaszas has already said, an NSPredicate isn't for sorting, it's for filtering
Hope this helps
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