I have an array coming from Core Data that I want to sort, using an orderNum field that I added to the database (Scene entity).
I make the following request to get data:
NSArray *scenes;
NSManagedObjectContext *context = [self managedObjectContext];
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Scenes" inManagedObjectContext:context];
[fetchRequest setEntity:entity];
NSError *error;
scenes = [context executeFetchRequest:fetchRequest error:&error];
return scenes;
How do I go about sorting the data returned in scenes by orderNum?