Contents

compare(_:_:)

Provides the relative ordering of two items according to the ordering of the properties that the comparator’s key path references.

Declaration

func compare(_ lhs: Compared, _ rhs: Compared) -> ComparisonResult

Parameters

  • lhs:

    The first property to compare.

  • rhs:

    The second property to compare.

Return Value

The relative ordering for the compared properties.

Discussion

The method returns flipped comparisons if the sort order is SortOrder.reverse.