Contents

NSSortDescriptor

An immutable description of how to order a collection of objects according to a property common to all the objects.

Declaration

class NSSortDescriptor

Overview

You construct instances of NSSortDescriptor by specifying the key path of the property to compare and the order of the sort (ascending or descending). Optionally, you can also specify a selector to use to perform the comparison, which allows you to specify other comparison selectors, such as localizedStandardCompare(_:) and localizedCaseInsensitiveCompare(_:). Sorting raises an exception if the objects don’t respond to the sort descriptor’s comparison selector.

You can use sort descriptors for the following:

Topics

Creating a Sort Descriptor

Getting Information About a Sort Descriptor

Using Sort Descriptors

Initializers

See Also

Sorting