Hemang Hemang - 5 days ago 6
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
Train
out of which, each objects are having proper
estimatedTimeOfArrival
value. But 3 objects has not proper values for
arrivalTime
.

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
arrivalTime
and then on
estimatedTimeOfArrival
.

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

Answer

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.

Comments