Is there a way to invert case .A = enumValue
and make it something like enumValue != .A
?
enum MyEnum {
case A
case B
case C
case D(something: OtherEnum)
}
let enumValue: MyEnum = ...
let otherValue: String = ...
if case .A = enumValue {
// Do nothing
} else {
if otherValue == "something" {
// Do stuff...
} else {
// Do other stuff...
}
}
// More code...
I'm trying to remove the empty if-block and reduce the number of lines, so I'm not looking for something like
var condition1 = true
if case .A = enumValue {
condition1 = false
}
if condition1 {
// ...
}