Learn to enforce primitives for concurrency in Swift using the async and await keywords, which will be available on iOS 15 and macOS 12.

Using the async and await keywords in Swift greatly simplifies how we write concurrent code in iOS applications.

When Swift was first introduced by Apple in 2014, it aimed to meet all of the demands that software engineers had for modern programming languages. Chris Lattner, who designed Swift at Apple, had the goal of making a language that could be used both for teaching programming and building software for operating systems.

Since then, Apple has open-sourced the language, and as a result, it continues to evolve. Despite improvements made to Swift, a key feature that is still missing is primitives for concurrency and parallelism.

In the past, you could imitate primitives in Swift using libraries like Grand Central Dispatch (GCD) and libdispatch. Nowadays, we can enforce primitives for concurrency using the async and await keywords.

In this tutorial, we’ll discuss what concurrency is and why it is useful. Then, we’ll learn to use the async and await keywords to enforce concurrency.

Let’s get started!

#swift #ios #mobile-apps #programming

Concurrency in Swift: Using the New Async/Await Syntax
60.80 GEEK