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
lhsThe first element to compare.
rhsThe 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.