Hereโs how you can learn Swift Concurrency in 2 hours ๐ฉ๐ฝโ๐๐จ๐ปโ๐
Hi ๐
I hope youโve had a nice week! On my end I was finally able to chill a bit, now that all the conferences I was scheduled to attend are over ๐
(I might even have gotten myself a new iPhone and a new Watch, but thatโs another story ๐)
And since I was at home last week, I was finally able to do a livestream with a new concept that Iโve had in mind for a few weeks!
But before I tell you more about it, I have a big thank you to my sponsor this week: Bitrise ๐ค
Advertisement
Join the Mobile DevOps Summit 2023 on Oct 4-5
A two-day, free event with 40+ workshops and sessions brought to you by 50+ industry-leading speakers from eBay, Reddit, AWS and more.
Learn from real-world examples of successful Mobile DevOps implementations!
๐ Check out the speaker list ๐
Sponsors like Bitrise really help me grow my content creation, so if you have time please make sure to have a look at the event theyโre organizing: itโs a direct support to my content creation โบ๏ธ
During the summer, I shared with you my training courses to learn SwiftUI or Combine in a short amount of time.
Their reception was extremely positive, so I figured: why not do the same for other important skills iOS developers need to master?
I felt that the next logical topic to address was Swift Concurrency, because in the two years since its release, it has really become the standard for asynchronous code in iOS apps.
But this time I added a twist to the formula!
Instead of teaching using only my own code examples, I selected 5 articles from great content creators, and then I went over them and added my own remarks and observations.
This way, you get to learn about Swift Concurrency through several different point of view, and my hope is that it will help you get a very comprehensive picture of the topic!
If youโre curious to watch it, the replay is available on YouTube!
And if you donโt have the time for a 2 hour video and you would prefer to read the 5 blog articles by yourself, I will also share them with you!
Async await in Swift explained with code examples
In this first article, Antoine van der Lee goes covers all the basic of Swift Concurrency: Whatโs an async
function? When do we need to use the await
keyword? Where are we allowed to call an async
function?
Wrapping existing asynchronous code in async/await in Swift
Once youโve learned the basics of Swift Concurrency, the question that naturally comes next is: How can I use my legacy completionHandler
-based functions with this new approach?
Thatโs the question Donny Wals answers in this second article ๐
Async let explained: call async functions in parallel
For this third article, weโre back to Antoineโs blog to learn about a very powerful feature of Swift Concurrency: How to define asynchronous constants that allow us to very easily run several async functions in parallel.
What role do Tasks play within Swiftโs concurrency system?
In the previous articles, youโve seen that when you need to call an async
function, one of the ways to do it is to wrap the call within a Task
.
In this article, John Sundell deeps dive into how a Task
works and what are the pitfalls to avoid when using one.
Understanding Swift Task Groups With Example
To finish, this article from Lee Kah Seng covers the last concept you need to grasp in order to get started with Swift Concurrency: TaskGroup
.
Weโve seen in a previous article how async let
allows us to run a static number of async
functions in parallel.
TaskGroup
serves a very similar purpose, except that itโs capable of handling a dynamic number of async
functions!
Conclusion
Thatโs the end of my list: once youโve read these 5 articles you should be familiar with all the main concepts of Swift Concurrency ๐
If you have any feedback on this approach of teaching a new skill through a collection of blog articles, please feel free to share it with me!
And if you have any suggestions of future topics that you would like me to cover, please also feel free to let me know ๐
Thatโs all for this email, thanks for reading it!
If youโve enjoyed it, feel free to forward it
to your friends and colleagues ๐
I wish you an amazing week!
โค๏ธ