Equatable protocol not called when enum compared in switch case, how does it compare values?

I have implemented below Enum which works perfectly with If Conditions but fails in Switch case, how does switch case compare case values? does it not use == internally?

here is my code

```
    import Foundation

public enum AMSelectionStyle{
    case single
    case multiple
    case any
}

public enum AMCalenderMode{
    case date
    case time
    case dateTime
    case any

}

public enum AMNumberType:String{
    case natural = "N" //(also called positive integers, counting numbers, or natural numbers); They are the numbers {1, 2, 3, 4, 5, …}
    case whole = "W" //This is the set of  natural numbers, plus zero, i.e., {0, 1, 2, 3, 4, 5, …}.
    case integer = "Z" // This is the set of all whole numbers plus all the negatives (or opposites) of the natural numbers, i.e., {… , ⁻2, ⁻1, 0, 1, 2, …}
    case rational = "Q" //This is all the fractions where the top and bottom numbers are integers; e.g., 1/2, 3/4, 7/2, ⁻4/3, 4/1 [Note: The denominator cannot be 0, but the numerator can be].
    case real = "R" //(also called measuring numbers or measurement numbers). This includes all numbers that can be written as a decimal. This includes fractions written in decimal form e.g., 0.5, 0.75 2.35, ⁻0.073, 0.3333, or 2.142857. It also includes all the irrational numbers such as π, √2 etc. Every real number corresponds to a point on the number line.
    case all = "" // all of the above
}
public enum AMInputType:Equatable {
    case list(AMSelectionStyle)
    case number(AMNumberType)
    case calender(AMCalenderMode)
    case freeText
    case boolian
    case picklist

   public static func ==(lhs: AMInputType, rhs: AMInputType) -> Bool {
        switch (lhs, rhs) {
        case (let .list(a1), let .list(a2)):
            if a1 == .any || a2 == .any {
                return true
            }else if a1 == .single && a2 == .single {
                return true
            }else if a1 == .multiple && a2 == .multiple {
                return true
            }
            return a1 == a2
        case (let .number(a1), let .number(a2)):
            if a1 == .all || a2 == .all {
                return true
            }else if a1 == .natural && a2 == .natural {
                return true
            }else if a1 == .whole && a2 == .whole {
                return true
            }else if a1 == .integer && a2 == .integer {
                return true
            }else if a1 == .rational && a2 == .rational {
                return true
            }else if a1 == .real && a2 == .real {
                return true
            }
            return a1 == a2
        case  (let .calender(a1), let .calender(a2)):
            if a1 == .any || a2 == .any {
                return true
            }else if a1 == .date && a2 == .date {
                return true
            }else if a1 == .time && a2 == .time {
                return true
            }else if a1 == .dateTime && a2 == .dateTime {
                return true
            }
            return a1 == a2
        case (.freeText, .freeText):
            return true
        case (.boolian, .boolian):
            return true
        case (.picklist, .picklist):
            return true
        default:
            return false
        }
    }

}

func compareEnum(inputType:AMInputType)->Bool{
    switch inputType {
    case .number(.all):
        print("Switch case `number` check Successful")
        return true
    case .calender(.any):
        print("Switch case `calender` check Successful")
        return true
    case .list(.any):
        print("Switch case `list` check Successful")
        return true
    default:
        print("Switch case check Failed")
        return false
    }
}

```

Comparison fails when enum parameter value is different for case number

```
compareEnum(inputType: .number(.real))

```

Comparison succeeded when enum parameters values are same for case number.

```
compareEnum(inputType: .number(.all))

```

If condition succeeds with different enum parameters of case number.

```
if AMInputType.number(.all) == AMInputType.number(.real) {
    print("If Condition `number` check Successful")
}

```

**Edit 1 - Converted enums to implement Equitable as per suggestion by @Tarun Tyagi**

Issue still exits. Equitable protocol not called in Switch case

```
    public enum AMSelectionStyle:Int, Equatable{
    case single
    case multiple
    case any

    public static func ==(lhs: AMSelectionStyle, rhs: AMSelectionStyle) -> Bool {
        switch (lhs, rhs) {

        case (.single, .single):
            return true
        case (.single, .multiple):
            return false
        case (.single, .any):
            return true

        case (.multiple, .multiple):
            return true
        case (.multiple, .single):
            return false
        case (.multiple, .any):
            return true

        case (.any, .any):
            return true
        case (.any, .single):
            return true
        case (.any, .multiple):
            return true

        }
    }
}

public enum AMCalenderMode:Int, Equatable{
    case date
    case time
    case dateTime
    case any

    public static func ==(lhs: AMCalenderMode, rhs: AMCalenderMode) -> Bool {

        switch (lhs, rhs) {

        case (.date, .date):
            return true
        case (.date, .time):
            return false
        case (.date, .dateTime):
            return false
        case (.date, .any):
            return true

        case (.time, .time):
            return true
        case (.time, .date):
            return false
        case (.time, .dateTime):
            return false
        case (.time, .any):
            return true

        case (.dateTime, .dateTime):
            return true
        case (.dateTime, .date):
            return false
        case (.dateTime, .time):
            return false
        case (.dateTime, .any):
            return true

        case (.any, .any):
            return true
        case (.any, .date):
            return true
        case (.any, .time):
            return true
        case (.any, .dateTime):
            return true

        }
    }

}

public enum AMNumberType:String, Equatable{
    case natural = "N" //(also called positive integers, counting numbers, or natural numbers); They are the numbers {1, 2, 3, 4, 5, …}
    case whole = "W" //This is the set of  natural numbers, plus zero, i.e., {0, 1, 2, 3, 4, 5, …}.
    case integer = "Z" // This is the set of all whole numbers plus all the negatives (or opposites) of the natural numbers, i.e., {… , ⁻2, ⁻1, 0, 1, 2, …}
    case rational = "Q" //This is all the fractions where the top and bottom numbers are integers; e.g., 1/2, 3/4, 7/2, ⁻4/3, 4/1 [Note: The denominator cannot be 0, but the numerator can be].
    case real = "R" //(also called measuring numbers or measurement numbers). This includes all numbers that can be written as a decimal. This includes fractions written in decimal form e.g., 0.5, 0.75 2.35, ⁻0.073, 0.3333, or 2.142857. It also includes all the irrational numbers such as π, √2 etc. Every real number corresponds to a point on the number line.
    case all = "" // all of the above

    public static func ==(lhs: AMNumberType, rhs: AMNumberType) -> Bool {

        switch (lhs, rhs) {

        case (.natural, .natural):
            return true
        case (.natural, .whole):
            return false
        case (.natural, .integer):
            return false
        case (.natural, .rational):
            return false
        case (.natural, .real):
            return false
        case (.natural, .all):
            return true

        case (.whole, .whole):
            return true
        case (.whole, .natural):
            return false
        case (.whole, .integer):
            return false
        case (.whole, .rational):
            return false
        case (.whole, .real):
            return false
        case (.whole, .all):
            return true

        case (.integer, .integer):
            return true
        case (.integer, .natural):
            return false
        case (.integer, .whole):
            return false
        case (.integer, .rational):
            return false
        case (.integer, .real):
            return false
        case (.integer, .all):
            return true

        case (.rational, .rational):
            return true
        case (.rational, .natural):
            return false
        case (.rational, .whole):
            return false
        case (.rational, .integer):
            return false
        case (.rational, .real):
            return false
        case (.rational, .all):
            return true

        case (.real, .real):
            return true
        case (.real, .natural):
            return false
        case (.real, .whole):
            return false
        case (.real, .integer):
            return false
        case (.real, .rational):
            return false
        case (.real, .all):
            return true

        case (.all, .all):
            return true
        case (.all, .natural):
            return true
        case (.all, .whole):
            return true
        case (.all, .integer):
            return true
        case (.all, .rational):
            return true
        case (.all, .real):
            return true
        }
    }
}

```