Is there a function that compares two objects using an array of NSSortDescriptor and returns the NSComparisonResult? (Putting them in an array will not identify equality.)
A:
You could easily wrote that function yourself. Just iterate over the array. The tricky design decision is why to do when different comparators return different results. E.g. Let's say we're comparing a Ferrari and a big pile of dirt using am array with two comparators: cost and size. The Ferrari costs more but the dirt pile is bigger. Which do we say is "greater"? That is a design decision you have to make based on your specific problem domain.
Jon Rodriguez
2010-09-24 22:27:59
A "built in" function would be simpler code and may implement some optimization. As for your example, the selector in the NSSortDescriptor would know how to compare the two. If the sort descriptors themselves were mutually exclusive, I wouldn't be using an array of descriptors. For now, I have implemented this function myself, but I'd still like to know if such a function exists. Thanks for the reply.
ED.
2010-09-25 07:54:35