The Secret to Intuitively Understanding Swift Concurrency
The Secret to Intuitively Understanding Swift ConcurrencyOne core concept that brings clarity to everything
My first brush with Swift concurrency was in 2022, inheriting a small startup codebase as a 1-man-iOS-team. This project had everything: detached tasks in a web-scraping system, async streams listening to repositories, and a central actor that handled authentication. Each tool I didn’t understand was a paper cut that stung me with imposter syndrome. How had I got so behind just a year after Swift Concurrency released? Over the subsequent year, like an ASMR mechanic on TikTok, I took each component of concurrency code apart, bit by bit, cleaned them, then put them back, a little more robust. This exercise, alongside my nascent writing habit, compelled me to develop an intuitive understanding of this new-fangled concurrency malarkey. I was a single-threaded dev marooned in a sea of concurrency. But we don’t all need trial by fire: Getting the hang of one thing will bring you towards an intuitive understanding of Swift Concurrency more than anything else. I’m not a hack, so I’ll tell you straight up before the paywall: It’s Tasks. Specifically, being able to reason about using tasks as properties. Building up this skill gives you the power to work with everything Swift Concurrency throws at you. If you pay me, I’ll be very happy, and I’ll share 5 detailed examples to demonstrate this concept and cement your intuition. If you’re already a Swift Concurrency savant, well, sh*t. Hopefully you like the thumbnail enough to give me money.
Continue reading this post for free in the Substack app |