I\'ve got an enumeration with a few different cases which are different types, e.g.
enum X { case AsInt(Int) case AsDouble(Double) }
As of Swift 2 (Xcode 7) this is possible with if/case and pattern matching:
if/case
let x : X = ... if case let .AsInt(num) = x { print(num) }
The scope of num is restricted to the if-statement.
num