Swift.org Blog Feli Bernutz Jul 6, 2022

Swift Language Updates from WWDC22

Article Summary

Swift just got a massive upgrade. Feli Bernutz, Matthaus Woolard, and Natalia Panferova break down the Swift 5.6 and 5.7 releases that are reshaping how iOS teams write concurrent, type-safe code.

WWDC22 brought two major Swift releases packed with language improvements, from regex literals to distributed actors. This deep dive covers the ecosystem changes, package manager updates, and concurrency enhancements that shipped in Swift 5.6 (March 2022) and Swift 5.7 (beta with Xcode 14).

Key Takeaways

Critical Insight

Swift 5.7 delivers production-ready concurrency tools, powerful regex support, and generics improvements that eliminate common type-system friction.

The article includes a clever Bird of the Year competition example that makes protocol improvements surprisingly easy to grasp.

About This Article

Problem

Swift developers couldn't use existential types with Self or associatedtype requirements. This meant they couldn't store protocol-conforming types in collections or pass them as parameters without building custom type-erasing wrappers.

Solution

Swift 5.7 added the 'any' keyword to mark existential types explicitly and lifted the previous restrictions. Developers can now review their code and swap out type-erasing wrappers for native existential types.

Impact

Swift codebases can become simpler by removing custom type-erasing abstractions. Developers can use existential types directly in arrays and function parameters, which cuts down on boilerplate code.