Initializer

init(key:ascending:)

Initializes a sort descriptor a given key path and sort order.

Declaration

init(key: String?, ascending: Bool)

Parameters

keyPath

The key path to use when performing a comparison.

For information about key paths, see Key-Value Coding Programming Guide.

ascending

true if the receiver specifies sorting in ascending order, otherwise false.

Return Value

A sort descriptor initialized with the specified key path and sort order, and the default comparison selector (compare).

See Also

Initializing a Sort Descriptor

init(key: String?, ascending: Bool, selector: Selector?)

Initializes a sort descriptor with a given key path, ordering, and comparison selector.

init(key: String?, ascending: Bool, comparator: Comparator)

Initializes a sort descriptor with a given key path and ordering, and a comparator block.