How to create bitmask in Swift

swift

Solution

From the documentation: Apple Inc. 'The Swift Programming Language'. iBooks. https://itun.es/nl/jEUH0.l

let shiftBits: UInt8 = 4   // 00000100 in binary
shiftBits << 1             // 00001000
shiftBits << 2             // 00010000
shiftBits << 5             // 10000000'

Problem

In Objective C I was making ``` uint32_t myFirstMask = 0x1 << 0; uint32_t mySecondMask = 0x1 << 1; ``` the question is - how to implement that in Swift.

Original source