I have the following sort descriptors that sort an array of my business objects, ready to be displayed in a table, I'm starting off with some sample sorting code from a previous SO question
NSSortDescriptor *sortDescriptor1 = [[NSSortDescriptor alloc] initWithKey:@"awardedOn" ascending:NO];
NSSortDescriptor *sortDescriptor2 = [[NSSortDescriptor alloc] initWithKey:@"title" ascending:YES];
NSArray *sortDescriptors = [NSArray arrayWithObjects:sortDescriptor1, sortDescriptor2, nil];
NSArray *sortedArray = [returnable sortedArrayUsingDescriptors:sortDescriptors];
The objects that I'm displaying all will have a title. Only some of them will have an "awardedOn" set, which is an NSDate.
What I want to do:
- Sort entire array so all the objects with an "awardedOn" set are displayed at the top
- Within the two "sets", order them alphabetically
- I don't care about the actual value of the date, I'm more interested if it exists or not
Something like this (Titles, the bold ones have a value for awardedOn)
- Awesome
- Better
- Cool
- Another
- Another One
- One more
- Yet Another