Hi Swift community, I have a question.
This is a valid Swift code:
func testFunc(times: Int, fn: ((Int)->Void)? = nil) {
guard let f = fn else { return }
for i in 1 ..< times {
f(i)
}
}
And this is not:
func testFunc(times: Int, @noescape fn: ((Int)->Void)? = nil) {
guard let f = fn else { return }
for i in 1 ..< times {
f(i)
}
}
I can't think of any hard reason why the @noescape parameter of the function
can't be nullable (and, with default value, be optional), but maybe I'm missing
something. Is there any plan to correct this in 3.0?
Alex_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution