Sorts the receiver in ascending order as defined by the comparison function
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
The comparison function to use to compare two elements at a time.
The function’s parameters are two objects to compare and the context parameter,
context. The function should return
NSOrderedif the first element is smaller than the second,
NSOrderedif the first element is larger than the second, and
NSOrderedif the elements are equal.
The context argument to be passed to the compare function.
This approach allows the comparison to be based on some outside parameter, such as whether character sorting is case sensitive or case insensitive.