Welcome to your interview.
The question is on your right: Escaping vs Non-Escaping Closures. Take a moment with it first.
Talk your thinking through with me if you like - when you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes). Discussion and graded submissions share your five interviewer interactions, so spend them well.
Closures are used heavily in Swift APIs for callbacks, collection operations, and asynchronous work. Interviewers ask this to test whether you understand closure lifetime, compiler rules, and memory implications.
Explain the difference between escaping and non-escaping closures in Swift.
Your answer should address:
@escaping is required in some function parametersselfThe expected depth is practical language understanding rather than compiler internals. You should define both terms clearly, explain when the compiler requires @escaping, and mention the relationship to asynchronous execution, stored callbacks, and retain-cycle risk.