sort(using:)
Sorts the receiver in ascending order, as determined by the comparison method specified by a given selector.
Declaration
func sort(using comparator: Selector)Parameters
- comparator:
A selector that specifies the comparison method to use to compare elements in the array.
The
comparatormessage is sent to each object in the array and has as its single argument another object in the array. Thecomparatormethod should returnNSOrderedAscendingif the array is smaller than the argument,NSOrderedDescendingif the array is larger than the argument, andNSOrderedSameif they are equal.