Instance Method

sortedArrayUsingDescriptors:

Returns a copy of the receiving array sorted as specified by a given array of sort descriptors.

Declaration

- (NSArray<ObjectType> *)sortedArrayUsingDescriptors:(NSArray<NSSortDescriptor *> *)sortDescriptors;

Parameters

sortDescriptors

An array of NSSortDescriptor objects.

Return Value

A copy of the receiving array sorted as specified by sortDescriptors.

Discussion

The first descriptor specifies the primary key path to be used in sorting the receiving array’s contents. Any subsequent descriptors are used to further refine sorting of objects with duplicate values. See NSSortDescriptor for additional information.

See Also

Sorting

sortedArrayHint

Analyzes the array and returns a “hint” that speeds the sorting of the array when the hint is supplied to sortedArrayUsingFunction:context:hint:.

- sortedArrayUsingFunction:context:

Returns a new array that lists the receiving array’s elements in ascending order as defined by the comparison function comparator.

- sortedArrayUsingFunction:context:hint:

Returns a new array that lists the receiving array’s elements in ascending order as defined by the comparison function comparator.

- sortedArrayUsingSelector:

Returns an array that lists the receiving array’s elements in ascending order, as determined by the comparison method specified by a given selector.

- sortedArrayUsingComparator:

Returns an array that lists the receiving array’s elements in ascending order, as determined by the comparison method specified by a given NSComparator block.

- sortedArrayWithOptions:usingComparator:

Returns an array that lists the receiving array’s elements in ascending order, as determined by the comparison method specified by a given NSComparator block.

NSComparator

Defines the signature for a block object used for comparison operations.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software