Last active
May 30, 2017 03:32
-
-
Save yoching/e362318ffd122fda319d234be369435e to your computer and use it in GitHub Desktop.
swift tuple parameter experiments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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