Advanced Pattern Matching

Pattern Types

Pattern Types

So now we've seen several patterns in action. But what's the syntax here? Which other things can we match for? Swift distinguishes 7 different patterns. We're going to have a quick look at each of them.

All of those patterns can not only be used with the switch keyword, but also with the if, guard, and for keywords. For details on this, read on.