Hemang Hemang - 8 months ago 57
Objective-C Question

Proper way of doing SORT operation in iOS for multiple fields at once

This is my class

class Train {
NSTimeInterval arrivalTime;
NSTimeInterval estimatedTimeOfArrival;

I will have 10 objects of the class
out of which, each objects are having proper
value. But 3 objects has not proper values for

My goal is to perform a SORT operation on the array of objects of this class.

So, what's the best way to achieve a SORT on both of the fields?

I am thinking to apply sort first on
and then on

This will make sense and good way of doing this stuff?

Answer Source

Because I didn't have enough time to take a different turn. I ended up performing two sort operations on by one. And the data is what which I was expecting.