SortDescriptor
A serializable description of how to sort numeric and String
types.
- iOS
- 15.0+
- macOS
- 12.0+
- tvOS
- 15.0+
- watchOS
- 8.0+
struct SortDescriptor<Compared>
A serializable description of how to sort numeric and String
types.
struct SortDescriptor<Compared>
import FoundationInternationalization
protocol Decodable
A type that can decode itself from an external representation.
protocol Encodable
A type that can encode itself to an external representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol Sendable
@preconcurrency protocol SortComparator<Compared> : Hashable, Sendable
A comparison algorithm for a given type.
init(_ keyPath: any KeyPath<Compared, String> & Sendable, comparator: String.StandardComparator)
Temporarily available as a replacement for init(_:comparator:)
with a default argument.
init(_ keyPath: any KeyPath<Compared, String?> & Sendable, comparator: String.StandardComparator)
Temporarily available as a replacement for init(_:comparator:)
with a default argument.
init(_ keyPath: any KeyPath<Compared, String> & Sendable, comparator: String.StandardComparator, order: SortOrder)
Temporarily available as a replacement for init(_:comparator:)
with a default argument.
init(_ keyPath: any KeyPath<Compared, String?> & Sendable, comparator: String.StandardComparator, order: SortOrder)
Temporarily available as a replacement for init(_:comparator:)
with a default argument.
init<Value>(_ keyPath: any KeyPath<Compared, Value> & Sendable, order: SortOrder = .forward) where Value : Comparable
init<Value>(_ keyPath: any KeyPath<Compared, Value?> & Sendable, order: SortOrder = .forward) where Value : Comparable
init(from decoder: any Decoder) throws
var keyPath: PartialKeyPath<Compared>? { get }
The key path to the field for comparison.
var order: SortOrder
Sort order.
var stringComparator: String.StandardComparator? { get }
A String.StandardComparator
value.
func compare(_ lhs: Compared, _ rhs: Compared) -> ComparisonResult
func hash(into hasher: inout Hasher)
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.