Skip to content

Instance Method

compare(_:_:)

iOS 15.0+ iPadOS 15.0+ Mac Catalyst 15.0+ macOS 12.0+ tvOS 15.0+ watchOS 8.0+
Provides the relative ordering of two elements.
func compare(_ lhs: Compared, _ rhs: Compared) -> ComparisonResult

Parameters

lhs

The first element to compare.

rhs

The second element to compare.

Return Value

The relative ordering between the two elements.

Discussion

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