Write modern, robust asynchronous code in Swift with async/await, tasks, actors, and everything in between!
You’ve been there before.
You’re writing concurrent code for your iOS app, and it runs into a race condition.
Or even worse, an unexplainable dreadful crash.
Deep down, you know you want to escape your old ways of implementing concurrent code (did someone say “GCD”? 🤨 ) and open the door for modern concurrency. After all, who doesn’t want to write powerful and safe concurrent apps with Swift?
But where do you start?
Modern Concurrency in Swift is here.
Our Modern Concurrency in Swift book is here to showcase everything you need to know about async/await, tasks, actors, and everything in between!
The last time Apple made a big deal about concurrency, it was for Grand Central Dispatch (GCD), which came out in 2009—which brought its fair share of issues but it was mostly designed for Objective-C.
But with the introduction of Swift 5.5, Apple added a new concurrency model featuring the async/await syntax, to let you write asynchronous code that looks like synchronous code! We’re so excited for you to dive deep and learn about async/await, among many other things in this book.
Who Is This Book For?
If you’re an advanced iOS dev who wants to break the chains of the “old” way of managing concurrency that was inherited from Objective-C and learn the new way of managing concurrency, this book is for you.
What’s Inside the Book?
This the very first edition of Modern Concurrency with Swift, and it kicks off with the basics of the modern concurrency model in Swift 5.5.
Section I: Modern Concurrency in Swift
We’ve got one section in this book, but it’s broken down into 11 chapters and it goes deep into modern concurrency concepts:
- Using async/await
- Task Groups
- Custom Asynchronous Sequences
- Testing Asynchronous Code
But, hold up! Just to be clear, this book isn’t all theory. You’ll build SuperStorage, an iOS app that lets you browse files you’ve stored in the cloud and download them for local, on-device preview. You’ll use AsyncSequence to achieve this. Here’s a sneak peek:
And here’s a sneak peek at Blabber, a messaging app that lets you chat with friends. It has some neat features like location sharing, a countdown timer and a friendly—but somewhat unpredictable—chatbot.
Here’s another app you’ll be building in this course, and it’s called EmojiArt. EmojiArt is an app that lets you browse an online catalog of digital emoji art. To verify that the digital art is authentic, the app reads the feed of current works of art from the server, verifies the digital signature of the images and, only then, displays them onscreen.
You’ll also work on Sky, an app that scans satellite imagery of the sky and analyzes it for signs of alien life. You’ll add an actor system that connects to local network devices over Bonjour. This will let you perform more concurrent scans by using system resources across the network.
What Do You Need?
To follow along with this book, you’ll need the following:
- A Mac running macOS Monterey (12.0) or later: Big Sur should work, but this book was written and tested on macOS Monterey, so your mileage may vary.
- Xcode 13 or later. Xcode is the main development tool for iOS. You’ll need Xcode 13 or newer for the tasks in this book. If you’re using Xcode 13.2 and above, the new async/await syntax and the rest of the modern concurrency features will work starting iOS 13 / macOS 10.15 SDK (or later). If using an older version of Xcode 13, you’ll only get modern concurrency support when targeting iOS 15 / macOS 12. You can download the latest version of Xcode from Apple’s developer site, here: apple.co/2asi58y.
- An intermediate level of Swift. Concurrency in general is a relatively advanced topic, so you’re expected to have at least an intermediate-level knowledge of Swift and its existing concurrency features. This book won’t teach pre-Swift 5.5 Concurrency features such as Grand Central Dispatch, but you should still be able to follow the contents of this book even if you’re not entirely proficient with them.
How to Get Your Own Copy
There are two ways you can get this book:
- Buy it individually: If you want to build up a custom library without a subscription, you can choose to buy the book individually. It’s available now for just $59.99 in our online store.
- Get it as part of our Pro subscription: Enjoy access to our videos and mobile development books in our Ultimate Pro subscription, including Modern Concurrency in Swift! Right now, you can get a full year’s subscription and save 20% off the cost of a regular monthly subscription. It’s simply the best investment for your development career.
We hope you enjoy this book! Feel free to reach out to us if you have any questions.
Say Hi to our Team! 👋
Meet the awesome folks who contributed to this book…
Marin Todorov [Author]: Marin Todorov is a developer, speaker, and author. He works for high profile clients most often doing Swift development. Besides crafting code, he enjoys blogging, writing books, teaching, and speaking. He sometimes open sources his code. More about Marin at: underplot.com.
Rich Turton [Tech Editor]: Rich Turton is a tech editor for this book. He’s been developing apps for Apple platforms since before it was cool. He lives in the UK with his wife, daughters, and terrible cat.
Felipe Laso Marsetti [Tech Editor]: Felipe Laso Marsetti is a tech editor for this book. He’s a Technical Lead working at Lextech Global Services. In his spare time Felipe enjoys learning new languages and frameworks, playing violin or guitar, cooking and also video games. You can follow him on Twitter as @iFeliLM or on his blog at programmer.pink.
Sandra Grauschopf [Editor]: Sandra Grauschopf is the editor of this book. She’s a freelance writer, editor, and content strategist as well as the Editing Team Lead at raywenderlich.com. She loves to untangle tortured sentences and to travel the world with a trusty book in her hand. You can follow her on Twitter at @sgrauschopf or learn more about her at grauschopf.com.
Shai Mishali [Final Pass Editor]: Shai Mishali is the final pass editor on this book. He’s an experienced, award-winning iOS specialist; as well as an international speaker, and a highly active open-source contributor and maintainer on several high-profile projects – namely, the RxSwift Community and RxSwift projects, but also releases many open-source endeavors around Combine such as CombineCocoa, RxCombine and more. As an avid enthusiast of hackathons, Shai took 1st place at BattleHack Tel-Aviv 2014, BattleHack World Finals San Jose 2014, and Ford’s Developer Challenge Tel-Aviv 2015. You can find him on GitHub and Twitter as @freak4pc.
Start Reading for Free Today
Modern Concurrency with Swift is out now—and what’s more, you can start reading the book for free:
Modern Concurrency in Swift has been automatically added to the collections of all Ultimate Pro subscribers.
On behalf of the book team, we hope this book helps you learn modern concurrency models, and escape your old ways of writing concurrent code!