Swift 3 introduced annotations @discardableResultfor functions to disable warnings for the return value of an unused function.
I am looking for a way to silence this warning for closing.
Currently, my code looks like this:
func f(x: Int) -> Int -> Int {
func g(_ y: Int) -> Int {
doSomething(with: x, and: y)
return x*y
}
return g
}
In different places, I call fonce to get a closure g, which I then call again:
let g = f(5)
g(3)
g(7)
g(11)
doSomething, g. Swift 3 . , g _ = g(...) ? , @discardableResult.