midiOS

What are closures in Swift?

Updated May 6, 2026

Short answer

Closures are self-contained blocks of functionality.

Deep explanation

They can capture variables from surrounding context and are similar to lambdas.

Real-world example

Completion handlers in networking calls.

Common mistakes

  • Strong reference cycles in closures.

Follow-up questions

  • What is escaping closure?
  • What is capture list?

More iOS interview questions

View all →