I know it is possible to sort an array with an NSSortDescriptor when I create the array, but is there a pre-built way to take an array that already exists and tell if it is already sorted?
If not, I can think of 2 ways I could do this myself:
- The code in this question.
- Creating a new array from my old array, but use a NSSortDescriptor when I make the new one, then check to see if the two arrays are equal.
My code optimization is a little rusty, so which of those 2 ways would be better (faster/most stable)? Or is there another way I could check that would be better than either of these?