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