I have a list of share prices with the properties dateTime
and value
.
Currently I am sorting the share prices when fetching them using a sort descriptor.
Now, I would like to change my code and store them in already sorted order to faster retrieve the most current share price (dateTime = max).
I am inserting the share prices one by one using
SharePrice *priceItem= [NSEntityDescription insertNewObjectForEntityForName:@"SharePrice" inManagedObjectContext:context];
How can I sort the share prices right after inserting them using a sort descriptor on dateTime
?
Or would I need to convert it to a NSMutableOrderedSet
and use sortUsingComparator:
?
Thank you!