tomquist/Equals

Enumerations with associated values

Opened this issue · 0 comments

Hey,
nice lib you have there.

I have code similar to this:

enum SortOptions: Equatable {
    case title(OrderOptions),
    duration(OrderOptions),

    static public func ==(lhs: SortOptions, rhs: SortOptions) -> Bool {
       switch (lhs, rhs) {
         case (.title(let a),   .title(let b)) where a == b: return true
         case (.duration(let a), .duration(let b)) where a == b: return true
         default: return false
        }
    }
}
enum OrderOptions: Int {
    case ascending = -1,
    descending = 1
}

Do you have any suggestions converting it to your Equals.append "pattern"?