Pattern matching in Swift