title: Can I use the pattern matching operator ~= to match an enum value to an enum type with an associated variable?
body: <p>I would like to compare an enum value to an enum type without using switch. The following code, for example, works using the <code>~=</code> operator: </p>
  
  <pre><code>enum MyEnum {
      case A, B
  }
  
  let myEnum = MyEnum.A
  
  let isA = myEnum ~= MyEnum.A
  </code></pre>
  
  <p><code>isA</code> equals <code>true</code> above.</p>
  
  <p>However, when I try to compare an enum of an enum type with an associated value, like below, I get the compile error <code>Binary operator '~=' cannot be applied to two MyEnum operands</code>.</p>
  
  <pre><code>enum MyEnum {
      case A, B(object: Any)
  }
  
  let myEnum = MyEnum.A
  
  let isA = myEnum ~= MyEnum.A
  </code></pre>
  
  <p>Is there a way to work around this error to use the <code>~=</code> pattern matching operator? Or is my only recourse the following syntax, which in my opinion is significantly more cumbersome:</p>
  
  <pre><code>enum MyEnum {
      case A, B(object: Any)
  }
  
  let myEnum = MyEnum.A
  
  let isA: Bool
  switch myEnum {
  case .A:
      isA = true
  default:
      isA = false
  }
  </code></pre>
  
  <p>Thanks in advance for your input and suggestions!</p>