Closure in Swift

Muhammad Abdullah Al Mamun
Stackademic
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

Photo by James Harrison on Unsplash

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…

--

--