Protocol
SortComparator
iOS 15.0+
iPadOS 15.0+
Mac Catalyst 15.0+
macOS 12.0+
tvOS 15.0+
watchOS 8.0+
A comparison algorithm for a specified type.
@preconcurrency protocol SortComparator<Compared> : Hashable, Sendable
Overview
Objects that conform to SortComparator provide a comparison algorithm and storage for the sort order to use when comparing.
Topics
Associated Types
associatedtype ComparedA type that the sort comparator can compare.
Instance Properties
var order: SortOrderThe sort order that the comparator uses to compare.
Instance Methods
func compare(Self.Compared, Self.Compared) -> ComparisonResultProvides the relative ordering of two elements based on the sort order of the comparator.
Relationships
Inherits From
Swift.EquatableSwift.HashableSwift.SendableSwift.SendableMetatype