Before deciding whether this is possible or not, consider why the if - let ... conditions work with one optional value: the reason this code compiles
if let constVar = testVar { ... }
lies in the fact that all optional types comply with the LogicalValue protocol, which handles a null check on an optional value.
This explains why your trick with the extra tuple didn't work either: the LogicalValue implementation LogicalValue checked if the tuple itself is not null, ignoring its components. The logic of Apple's solution is obvious: instead of making an exception for tuples, when all their element types are optional, they used a single approach and treated the tuple in the same way as other optional types.
Of course, implementing the logic you are trying to implement is easy with an extra line of code:
if a != nil && b != nil { let (m, n) = (a!, b!) println("m: \(m), n: \(n)") } else { println("too bad") }
source share