HWS+ is an all new service from Hacking With Swift. As of writing, it has 3 courses, which each have a few sections. Until WWDC, HackingWithSwift will publish a new section to one of the 3 courses every day, which afterwards will be every few days.
I can say, after watching all the videos that are released, that they are from really high quality(not only the resolution, also the content🙂!), and are really recommended if you want to level up in your swift and iOS development skills.
Once you are there, be sure to check out the other courses they have here
When you work with closures, you sometimes see the keyword: @escpaing In this article, I aim to explain to you what it does, means and how to use it.
What an escaping closure does and means.
When you mark your closure in a function parameter as @escpaing , you are saying that the closure that is called in the function could run after the function is has run. In other words: The closure outlives the function. It could run after the function, even though it is called inside the function.
Use case for an escaping closure.
One of the most common use case for an escaping closure, is networking. Let’s say you have an app that needs to make a network call to get the user information from the server. Normally, your function will make the network call, get the data, and do something with it. Once that is done, it will stop running, and get expelled from the memory. But, that is not always what you want. For example, if you would want to update the UI according the data you got back from he server. In that case, if your closure I not marked @escpaing , the function will get expelled from the memory before the closure has run. That is not something you would want, as that would make it very difficult if you will need to update the UI according the data received from the server. On top of that, Xcode wont build your code. It recognises that you have a closure that could run after the function is done running.
I hope you know now what the @escpaing means, and that you can use it without thinking what it does.
Don’t forget that you can email me at email@example.com for any questions, feedback or if you just want to say hi.