Swift is now open source. For the latest news, visit the Swift open source blog

Patterns Playground

In Swift, a pattern is a way to describe and match a set of values based on certain rules, such as:

  • All tuples whose first value is 0
  • All numbers in the range 1...5
  • All class instances of a certain type

The learning playground linked below includes embedded documentation and experiments for you to perform. Download it for an interactive experience that will give you a jump start into using patterns in your own apps.

This playground requires the latest beta version of Xcode 6 on OS X Mavericks or OS X Yosemite beta.

All Blog Posts