Initializer

init(key:ascending:selector:)

Creates a sort descriptor with a specified string key path, ordering, and comparison selector. ソート記述子をある指定された文字列キーパス、順序付け、そして比較セレクタ(選択子)で作成して返します。

Declaration 宣言

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

Parameters パラメータ

key

The key path for performing a comparison.

For information about key paths, see Key-Value Coding Programming Guide. キーパスについての情報として、Key-Value Coding Programming Guideを見てください。

ascending

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

selector

The method to use when comparing the properties of objects, such as localizedStandardCompare(_:). The selector must specify a method that you implement according to the value of the property that the key path identifies. Pass the selector a single parameter, the object to compare against, and it returns the appropriate ComparisonResult constant.

Return Value 戻り値

A sort descriptor that initializes with the specified key path, sort order, and comparison selector.

See Also 参照

Creating a Sort Descriptor ソート記述子を作成する