I create a enum type (Swift 4.0):
enum TraceResult{
case nothing
case success
case failed
case custom(String) //#1
}
after that I decide to compare two enum values :
let tr = TraceResult.nothing
if tr == TraceResult.success{ //#2
//do something...
}
and compiler will complain a error in line #2:
Binary operator '==' cannot be applied to two 'TraceResult' operands
If I remove line #1,It's all right!!!
Or I used 'switch' statement to compare them ,It's also OK!!!
So Is possible to compare two TraceResult values with 'if' statement???
Thanks ;)