Skip to content

Instantly share code, notes, and snippets.

@yoching
Last active May 30, 2017 03:32
Show Gist options
  • Select an option

  • Save yoching/e362318ffd122fda319d234be369435e to your computer and use it in GitHub Desktop.

Select an option

Save yoching/e362318ffd122fda319d234be369435e to your computer and use it in GitHub Desktop.
swift tuple parameter experiments
func someFunc(a: Int, b: Int) -> String {
return "a = \(a), b = \(b)"
}
let parameters = (a: 0, b: 0)
// someFunc(parameters) // not allowed in swift 3
let numbers: [Int] = [1, 2, 3]
numbers
.map { number -> (a: Int, b: Int) in
return (a: number, b: number)
}
.map(someFunc) // allowed even in swift 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment