@unrequired in function signature for optional closure parameters

I'm not sure which would be the best way to approach the problem (if the community shares the idea that there actually is a problem).

What I know is that I saw this @escaping behaviour with optional closures creating some confusion in the community of young swift developers. Whoever ignores the nature of Optional wonders why @escaping is specified whenever the function will use the closure after return except for cases where the closure is optional, in which the usage of the closure by the function is unspecified without additional documentation.

The statement "by default closure are nonescaping" and the missing @escaping for Optional closures causes confusion.

This seems so obvious to me now, but I honestly had no idea why optional closures were treated differently.

1 Like