NEW: Subscribe to Hacking with Swift+ and accelerate your learning! >>

when to use Closures?

Forums > Swift

Hi!, i'm doing the course of Swift and i am in the closures videos, the thing is, i'd like to know specific cases of the best practices for the use of closures please,

Gret job with the courses btw! they are really helping me :D


Closures are used in a lot of different places. Animations for one. Another use case is with asynchronous operations, to do something when it completes (completion handlers) ...

You'll get used to them the more you get into swift and programming ...


Hacking with Swift is sponsored by Paw

SPONSORED Use Paw to build, test and describe web APIs. Paw has a lightning fast native macOS interface to compose requests, collaborate in real-time on API specs, and generate client code for your applications. You can import and export API definitions.

Discover Paw for Mac

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

Unknown user

Not logged in

Log in

Link copied to your pasteboard.