My current version for get @min or @max value is:
for (NSManagedObject *destination in allSpecifics)
{
[allRates addObject:[destination valueForKey:@"rate"]];
}
NSExpression *arrayExpression = [NSExpression expressionForConstantValue: allRates];
NSArray *argumentArray = [NSArray arrayWithObject: arrayExpression];
NSExpression* expression = [NSExpression expressionForFunction:@"min:" arguments:argumentArray];
id result = [expression expressionValueWithObject: nil context: nil];
NSNumber *rateForAdd = result;
allSpecific is array of NSManagedObjects. Looks like is a not good way to fill array of objects before (memory and process time cost). Probably somebody can help refactor it?