Skip to content

Instantly share code, notes, and snippets.

@bjhomer
Created October 4, 2016 23:06
Show Gist options
  • Save bjhomer/df69be84378eea0b58c98a45554ab93a to your computer and use it in GitHub Desktop.
Save bjhomer/df69be84378eea0b58c98a45554ab93a to your computer and use it in GitHub Desktop.
What's wrong here?
func doThing(x: Int, y: Int, z: Int) -> Int {
return x + y + z
}
class Foo {
func doThing(x: Int) {
doThing(x: x, y: 2, z: 4) // extra argument 'y' in call
}
}
@bjhomer
Copy link
Author

bjhomer commented Oct 4, 2016

It appears that this works:

func doThing(x: Int, y: Int, z: Int) -> Int {
    return x + y + z
}

class Foo {

    func doThing(x: Int) -> Int {
        let result = doThing(x:y:z:)(x, 2, 4)
        return result
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment