title: Bitwise operations with CGBitmapInfo and CGImageAlphaInfo
body: <p>I'm having trouble performing bitwise operations with <code>CGImageAlphaInfo</code> and <code>CGBitmapInfo</code> in Swift.</p>
  
  <p>In particular, I don't know how to port this Objective-C code:</p>
  
  <pre><code>bitmapInfo &amp;= ~kCGBitmapAlphaInfoMask;
  bitmapInfo |= kCGImageAlphaNoneSkipFirst;
  </code></pre>
  
  <p>The following straightforward Swift port produces the somewhat cryptic compiler error <code>'CGBitmapInfo' is not identical to 'Bool'</code> on the last line:</p>
  
  <pre><code>bitmapInfo &amp;= ~CGBitmapInfo.AlphaInfoMask
  bitmapInfo |= CGImageAlphaInfo.NoneSkipFirst
  </code></pre>
  
  <p>Looking at the source code I noticed that <code>CGBitmapInfo</code> is declared as a <code>RawOptionSetType</code> while <code>CGImageAlphaInfo</code> isn't. Maybe this has something to do with it? </p>
  
  <p>It doesn't help that the official documentation on bitwise operators doesn't cover enums.</p>