Recently I've saw the WWDC 2015 keynote from Apple. I also looked at some documentation but I can't find a "pattern matching in if" section, how it was written on one of the slides which they have shown. (68min 00sec video from Apple Events)
Do you know what's this refers to? Or the syntax?
All it really means is that if statements now support pattern matching like switch statements already have. For example, the following is now a valid way of using if/else if/else statements to "switch" over the cases of an enum.
And the following is now an acceptable way of checking if
someInteger
is within a given range.Here are a couple more examples using the optional pattern from The Swift Programming Language