Protocolswift 6.0.1FoundationEssentials
SortComparator
A comparison algorithm for a given type.
- iOS
- 15.0+
- macOS
- 12.0+
- tvOS
- 15.0+
- watchOS
- 8.0+
@preconcurrency protocol SortComparator<Compared> : Hashable, Sendable
Browse conforming typesA comparison algorithm for a given type.
@preconcurrency protocol SortComparator<Compared> : Hashable, Sendable
import FoundationEssentials
associatedtype Compared
The type that the SortComparator
provides a comparison for.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol Sendable
protocol Equatable
A type that can be compared for value equality.
var order: SortOrder { get set }
If the SortComparator
s resulting order is forward or reverse.
func compare(_ lhs: Self.Compared, _ rhs: Self.Compared) -> ComparisonResult
The relative ordering of lhs, and rhs.