Initializer

init(_:comparing:)

Creates a sort descriptor using a sort descriptor and a type that you specify.

Declaration 宣言

init?(_ descriptor: NSSortDescriptor, comparing comparedType: Compared.Type) where Compared : NSObject

Parameters パラメータ

descriptor

A sort descriptor.

comparedType

The type that the sort descriptor compares.

Discussion 議論

Returns nil if there isn’t a SortDescriptor equivalent to the NSSortDescriptor you specify, or if the selector to NSSortDescriptor isn’t one of the standard string comparison algorithms or compare(_:).

The comparison for the created SortDescriptor uses the selector to the associated NSSortDescriptor directly, so in cases where the comparison of NSSortDescriptor might crash, the SortDescriptor comparison crashes as well.

See Also 参照

Creating Sort Descriptors