In the early days of the Swift language, it took just a few hours to learn the fundamentals of the language. I'm sorry to say that that is no longer true. Swift has become richer and, as a result, more complex. The language has become much more capable, but those capabilities come at a price, increased complexity.

You may wonder whether those capabilities and the complexity they add are necessary. One of the reasons the Swift language was warmly welcomed by developers was its gentle learning curve. Getting started was simple. That is still true, but the learning curve has become significantly steeper.

Swift Evolution

Why did the language become more complex over the years? The first versions of the Swift language were easy to pick up because a number of key responsibilities were ignored or delegated. What do I mean by that? The Swift team took its time to let the language and its community mature. This has proven to be a smart strategy. It has led to a bit of a bumpy road in the early days of the language, but the result is what we have today. Swift is a modern, powerful, and flexible programming language. It is exactly what developers have been asking for.

The early versions of Swift weren't designed for a multithreaded environment. While Swift could be used in a multithreaded environment, the language didn't provide native support for concurrency. That changed with the release of Swift 5.5 and the introduction of Swift Concurrency. Before the introduction of Swift Concurrency, developers relied on other technologies such as Grand Central Dispatch.

Due to the lack of native support for concurrency, the compiler wasn't able to check your work and that inevitably resulted in code that wasn't threadsafe. Swift Concurrency changes this in a big way. It is fair to say that Swift Concurrency revolutionizes how Swift operates in a multithreaded environment. Not only does Swift Concurrency make it possible to take advantage of the power of the device your application runs on, it has the potential to do this more efficiently than other technologies like Grand Central Dispatch. Performance and efficiency are key features of Swift Concurrency.

Another key feature of Swift Concurrency is compiler support. Because the language natively supports concurrency, the compiler can help you avoid bugs, such as data races.

A Steeper Learning Curve

While it is possible to push Swift Concurrency aside, it isn't something I recommend. The devices your application runs on are powerful and your application needs to take advantage of that power. That is only possible by writing code that works in a multithreaded environment. Swift Concurrency helps you write such code in a safe manner.

The drawback is that the learning curve for Swift is steeper. It is actually quite a bit steeper because concepts like synchronous and asynchronous programming, data races, concurrent and parallel execution are no longer concepts you can worry about later. Because Swift natively supports concurrency, developers need to become familiar with these concepts sooner rather than later.

Combine and Grand Central Dispatch

Does Swift Concurrency replace Apple's Combine framework or Grand Central Dispatch? The answer is no. Both technologies have their place and continue to have their value. Most developers will use Combine and Swift Concurrency side by side, especially in SwiftUI projects.

As you adopt Swift Concurrency, your need to reach for Grand Central Dispatch decreases substantially. Grand Central Dispatch still has value, but Swift Concurrency provides alternatives that are often more performant and more efficient. You learn why that is later in this series.

Take Your Time

Be prepared that Swift Concurrency can be overwhelming in the beginning, but don't let that scare you. The mistake most developers make is not taking the time to learn the fundamentals first. Swift Concurrency isn't mind-bogglingly complex. The core concepts are actually simple and easy to understand. I strongly recommend taking your time to learn the fundamental concepts. Once you understand those, the pieces of the puzzle automatically fall into place.

What's Next?

In this series, you learn everything you need to know to correctly and efficiently use Swift Concurrency in your projects. You also learn about the inner workings of Swift Concurrency because I have found that that helps developers understand why things work the way they do.

We start simple with async and await. These two keywords transform the code you write by removing the need for completion handlers and improving the performance of your code. Actors are an instrumental ingredient of Swift Concurrency to protect your code from data races. The main actor is a special kind of actor that we encounter frequently.

Later in this series, we dive deeper into the more advanced aspects of Swift Concurrency, such as structured and unstructured concurrency. Even though these aspects are more advanced, it is important that you know what they are and how to use them.

As you make your way through this series, remember that it may take some time for these concepts to sink in. It is perfectly fine if something doesn't make sense at first. At the end of this series, you should be comfortable using Swift Concurrency in your projects. That's the goal. I'm here to help you along the way.