Updated for Xcode 14.2
We’ve covered a lot about closures in the previous chapters, so let’s recap:
Void
– also known as “nothing”.in
.$0
and $1
, but I would recommend doing that only under some conditions.Of all the various parts of the Swift language, I’d say closures are the single toughest thing to learn. Not only is the syntax a little hard on your eyes at first, but the very concept of passing a function into a function takes a little time to sink in.
So, if you’ve read through these chapters and feel like your head is about to explode, that’s great – it means you’re half way to understanding closures!
SPONSORED From March 20th to 26th, you can join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer!
Sponsor Hacking with Swift and reach the world's largest Swift community!
Link copied to your pasteboard.