General topic questions
Escaping vs Nonescaping Closures
MediumCommon
Free section · general topics & algorithms
What’s the difference between escaping and non-escaping closures?
Reveal model answer
Non-escaping run before the function returns (default). Escaping may outlive the call (async callbacks, stored handlers) and need @escaping; they require care with capture lists to avoid retain cycles.