CollectionComparable is a Swift Package Manager package for iOS/tvOS (10.0 and above), watchOS (4.0 and above), and macOS (10.14 and above), under Swift 5.0 and above, adding a protocol extension to Collection so that it's Comparable when its Element type is Comparable.
/// This isn't sufficient. Concrete types conforming to `Collection` who want to be
/// `Comparable` still need to declare conformance to `Comparable`. That's because
/// `Collection` is a *protocol*, not a concrete type, and protocols can't be extended
/// to add conformances to other protocols, ie, we can't say
///
/// `extension Collection: Comparable where Element: Comparable { ... }`
///
public extension Collection where Element: Comparable {
static func < (lhs: Self, rhs: Self) -> Bool
}CollectionComparable is provided only as a Swift Package Manager package, because I'm moving away from CocoaPods and Carthage, and can be easily installed directly from Xcode.
CollectionComparable is available under the MIT license. See the LICENSE file for more info.