@escaping vs @nonescaping closures

I know this is a frequently asked question, but...

After reading many articles on the net, I am still not sure if I have a solid understanding of the logics behind the design.

One of my puzzles around this question is - Is the Swift compiler clever enough so that I can solely rely on its warnings/errors?

Answered by DTS Engineer in 777798022

Is the Swift compiler clever enough so that I can solely rely on its warnings/errors?

Yes. Unless you do something weird to actively subvert the checking — for example, invoking the withoutActuallyEscaping(_:do:) function — Swifts escape checking is reliable.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

Is the Swift compiler clever enough so that I can solely rely on its warnings/errors?

Yes. Unless you do something weird to actively subvert the checking — for example, invoking the withoutActuallyEscaping(_:do:) function — Swifts escape checking is reliable.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

@escaping vs @nonescaping closures
 
 
Q