What’s new in Swift 5.9?

This is an Xcode playground that demonstrates the new features introduced in Swift 5.9:

  • if and switch expressions
  • Value and Type Parameter Packs
  • Macros
  • Noncopyable structs and enums
  • consume operator to end the lifetime of a variable binding
  • Convenience Async[Throwing]Stream.makeStream methods
  • Add sleep(for:) to Clock
  • Discarding task groups

This is designed to complement my existing article What’s New in Swift 5.9. You might also want to read previous articles about the evolution of Swift 5:

Alternatively, here you can find a complete breakdown of all Swift changes from 1.0 through 6.0, including downloadable playgrounds: what's new in Swift.

If you hit problems or have questions, you're welcome to tweet me @twostraws or email paul@hackingwithswift.com.

Screenshot of Xcode 15.4 running this playground.