Swiftのenumは便利ですが,たまには使い慣れたNS_OPTIONSスタイルのenumを作りたくなるときがあります. 素朴にやるとこのように実装できます. /// My Options enum Options: UInt { case None = 0 case A = (1 << 0) case B = (1 << 1) } しかし,これでは全ての組み合わせのパターンをcaseとして用意する必要がありますし,用意したところで常にrawValueでの比較が必要です. // My Options doesn't have it! let options: Options = Options(rawValue: .A.rawValue | .B.rawValue) こんなのはとてもじゃないけど使えません. UIViewAutoresizingの実装を見てみる UIKitにはNS_OPTI