Skip to content

Repository files navigation

CollectionComparable

XcodeSwiftGitHub tag (latest SemVer)GitHub

What

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 { ... }`
///
publicextensionCollectionwhere Element:Comparable{staticfunc<(lhs:Self, rhs:Self)->Bool}

Installation

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.

License

CollectionComparable is available under the MIT license. See the LICENSE file for more info.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages