Structure
KeyPathComparator
iOS 15.0+
iPadOS 15.0+
Mac Catalyst 15.0+
macOS 12.0+
tvOS 15.0+
watchOS 8.0+
A comparator that uses another sort comparator to provide the comparison of values at a key path.
struct KeyPathComparator<Compared>
Topics
Operators
Initializers
Instance Properties
let keyPath: any PartialKeyPath<Compared> & SendableThe key path that the comparator uses to compare properties.var order: SortOrderThe sort order that the comparator uses to compare properties.
Instance Methods
func compare(Compared, Compared) -> ComparisonResultProvides the relative ordering of two items according to the ordering of the properties that the comparator’s key path references.func hash(into: inout Hasher)
Relationships
Conforms To
SortComparatorSwift.EquatableSwift.HashableSwift.SendableSwift.SendableMetatype