One Logo Pool Ball
Foundation · IOS API REFERENCE

NSSortDescriptor

class · SDK 27.1

class NSSortDescriptor

Members (12)

method · iOS 7.0+

allowEvaluation

TypeScript
allowEvaluation(): void
Swift declaration
func allowEvaluation()
method

compare

TypeScript
compare(object1: unknown, object2: unknown): ComparisonResult
Swift declaration
func compare(_ object1: Any, to object2: Any) -> ComparisonResult
init

init

TypeScript
static initCoder(coder: NSCoder): (NSSortDescriptor) | null
Swift declaration
init?(coder: NSCoder)
init

init

TypeScript
static initKeyAscending(key: (string) | null, ascending: boolean): NSSortDescriptor
Swift declaration
init(key: String?, ascending: Bool)
get

ascending

TypeScript
get ascending(): boolean
Swift declaration
var ascending: Bool { get }
get · iOS 4.0+

comparator

TypeScript
get comparator(): ((arg0: unknown, arg1: unknown) => Promise<ComparisonResult>)
Swift declaration
var comparator: Comparator { get }
get

key

TypeScript
get key(): (string) | null
Swift declaration
var key: String? { get }
get

reversedSortDescriptor

TypeScript
get reversedSortDescriptor(): unknown
Swift declaration
var reversedSortDescriptor: Any { get }
init · iOS 8.0+

init

TypeScript
static initKeyPathAscending(keyPath: SDKHandle, ascending: boolean): NSSortDescriptor
Swift declaration
convenience init<Root, Value>(keyPath: KeyPath<Root, Value>, ascending: Bool)

Creates a sort descriptor with a specified key path and ordering. - Parameters: - keyPath: The key path to the property to compare. - ascending: If `true`, the sort descriptor compares using the ``SortOrder/forward`` sort order; otherwise, it uses ``SortOrder/reverse``.

get · iOS 8.0+

keyPath

TypeScript
get keyPath(): (SDKHandle) | null
Swift declaration
var keyPath: AnyKeyPath? { get }

The key path that specifies the property to compare during sorting.

init · iOS 15.0+

init

TypeScript
static init(sortDescriptor: SortDescriptor<_ObjectiveC_NSObject>): NSSortDescriptor
Swift declaration
@backDeployed(before: iOS 17, macOS 14, tvOS 17, watchOS 10)
convenience init<Compared>(_ sortDescriptor: SortDescriptor<Compared>) where Compared : NSObject

Creates an `NSSortDescriptor` representing the same sort as the given `SortDescriptor`. - Parameters: - sortDescriptor: The `SortDescriptor` to convert.

init · iOS 15.0+ · Deprecated in iOS 17.0

init

TypeScript
static init3797(sortDescriptor: SortDescriptor<unknown>): NSSortDescriptor
Swift declaration
convenience init<Compared>(_ sortDescriptor: SortDescriptor<Compared>)

Skipped declarations

5 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

NSSortDescriptor.init(keyPath:ascending:comparator:)

callback cannot propagate synchronous failure

NSSortDescriptor.init(key:ascending:selector:)

Objective-C selectors cannot cross the bridge.

NSSortDescriptor.selector

Objective-C selectors cannot cross the bridge.

NSSortDescriptor.init(key:ascending:comparator:)

callback cannot propagate synchronous failure

NSSortDescriptor.init()

inherited init: cannot prove legal (class declares 7 custom initializers)

All Foundation types →