Initializer

init(key:ascending:comparator:)

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

Declaration

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

Parameters

key

The property key 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.

cmptr

A comparator block.

Return Value

A sort descriptor initialized with the specified key, ordering, and comparator.

See Also

Initializing a Sort Descriptor

init(key: String?, ascending: Bool)

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

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

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

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