Closure in Swift
Published in
2 min readMay 4, 2024
Closures is self-conitained blocks of funcionality that can be passed around and used in your code — Apple
Expression:
{ (params) -> return value in
//statements
}
@escaping:
When you mark a closure as escaping, you’re saying it can hang around even after the function it’s defined in has finished running.
func…