Hacking with Swift Live 2021

BONUS: Get hands on with key new features from WWDC21.

These articles are presented as free bonus material for Hacking with Swift+ subscribers, providing the videos recorded live at the event plus approximate text for those videos. The articles are only "approximate" because it was a live event – lots of questions were asked and answered along the way, and the videos also explore some bonus tangents not included in the articles.

Both the videos and articles regularly walk you through an interesting piece of code in a test project, set you an example task to implement that code in a real project, then usually provide an example solution for you to try if you weren't sure. It is strongly recommended you read them in order.

Day 1: What's new in Swift?

In this first day we start by looking at the core new features of Swift 5.5, before moving on to the basics of async/await.

What’s new in Swift 5.5?


1. What’s new in Swift 5.5?

In this introductory video we start by walking through all the main changes introduced with Swift 5.5, without touching on concurrency – that still leaves a heck of a lot!

Introducing concurrency


2. Introducing concurrency

The concurrency changes in Swift are powerful and wide-ranging, so if you want to take advantage of new SwiftUI features such as task() or refreshable() you need to start here.

Synchronous vs asynchronous


3. Synchronous vs asynchronous

Now that you’ve had a taste of how async/await code looks, let’s break down what we just saw and examine how asynchronous functions work behind the scenes, and how we can move over to async let with surprising ease.



4. Tasks

At this point we’ve looked at writing code using async/await, using continuations to bridge old code, then optionally using async let as well. Here we’re going to expand our concurrency knowledge to include tasks and task groups, which provide much more control over our work.

Day 2: Advanced Concurrency

On day 2 we moved up to looking at tasks, task groups, and actors, then ending by moving over to the new features of SwiftUI.

Advanced tasks


5. Advanced tasks

One of the big advantages to tasks is that we can pause them, or cancel them outright if their work is longer needed. Even better, for bigger problems we can create whole groups of tasks to accomplish work together.

Advanced task groups


6. Advanced task groups

Now that you understand the basics of task groups, we can start to look at handling cancellation, but also looking at making task groups where each task returns a different kind of data.

On to actors


7. On to actors

In this part we finish by directly comparing async let, tasks, and task groups, then move on to the final boss of Swift concurrency: actors.

Final tips then SwiftUI


8. Final tips then SwiftUI

We’re about to start exploring the many SwiftUI changes introduced this year, but before we’re done with concurrency we have two last techniques to explore.

Day 3: SwiftUI and Foundation

On the final day we added more of the new SwiftUI features to our app, then finished up by looking at improvements in Foundation.

Continuing SwiftUI


9. Continuing SwiftUI

Now that we have covered all the changes in Swift concurrency, we can start to look at the changes in SwiftUI, starting with refreshable() and searchable().

Swipe actions, Markdown, and focus


10. Swipe actions, Markdown, and focus

iOS 15 introduced a great many customization points to give us more control over list rows, text rendering, keyboard focus, and more, and these are all covered here.

Finishing up


11. Finishing up

In this final section we start by solving the problem from the previous section, but then cover keyboard input accessories and visual effect blurs, then finish up by looking at AttributedText and formatted() from Foundation.