Understanding Swift’s OptionSet

OptionSet is a Swift type that presents a mathematical set interface to a bit set. The protocol is used to represent bitset types, where individual bits represent members of a set. Even if you have not explicitly implemented the OptionSet protocol, you have likely used OptionSet when using Apple APIs. In this post, Donny Wals provides a good overview of the OptionSet type, including a look at some of Swift's bitwise operators.