Skip to content

Structure

ComparableComparator

iOS 15.0+ iPadOS 15.0+ Mac Catalyst 15.0+ macOS 12.0+ tvOS 15.0+ watchOS 8.0+
A comparator that compares types according to their conformance to the comparable protocol.
struct ComparableComparator<Compared> where Compared : Comparable

Overview

The comparator uses the relevant type’s doc://com.apple.documentation/documentation/swift/comparable implementation to compare instances.

Topics

Initializers

Instance Properties

Instance Methods

Relationships

Conforms To

  • SortComparator
  • Swift.Equatable
  • Swift.Hashable
  • Swift.Sendable
  • Swift.SendableMetatype