[Solved] Sorting in Objective C [duplicate]


For a full explanation see this answer from a related question.


In short you basically have to implement…

- (NSComparisonResult)compare:(Contact *)otherContact;

…in your Contact class (order of comparison: self, otherContact).

NSComparisonResult has three possible values: NSOrderedAscending, NSOrderedSame and NSOrderedDescending.

solved Sorting in Objective C [duplicate]