func callAsFunction
has been merged and is available in latest development snapsnots from Swift.org - Download Swift.
I just tested swift-DEVELOPMENT-SNAPSHOT-2019-08-27-a
:
struct Adder {
var base: Int
func callAsFunction(_ x: Int) -> Int {
return x + base
}
}
var adder = Adder(base: 3)
print(adder(10)) // 13
Thanks for your patience!