Swift 5.5 Adds Concurrency Support
Written by Kay Ewbank   
Tuesday, 05 October 2021

Swift 5.5 has been released with new features for asynchronous code and concurrency including async/await, structured concurrency, and Actors.  Swift is Apple's language that was originally developed as an alternative language to Objective C.

Swift's designers aim is to provide a single language including the best ideas from languages such as C# and JavaScript, while being easy to use. It was made open source by Apple in 2015, and a Linux build was added at that point.


The improvements to Swift 5.5 start with support for coroutine models to make it easier to write asynchronous code. The developers say a lot of Swift code involves async programming using closures and completion handlers, but these APIs are hard to use. To overcome this, the new coroutine model means functions can opt into being async, so developers can have asynchronous operations using the normal control-flow mechanisms. The compiler is responsible for translating an asynchronous function into an appropriate set of closures and state machines.

Another improvement is the addition of structured concurrency. This uses the async/await improvements, and adds the ability to execute, cancel, and monitor concurrent operations in Swift. The asynchronous functions introduced with async can give up the thread on which they are executing at any given suspension point, but they don't actually introduce concurrency. This has been added separately to provide a way to support concurrent execution of asynchronous code. Structured concurrency relies on tasks being split into high-level tasks and their child component tasks.

Other improvements add support for creating and awaiting child tasks using the simple syntax async let as an alternative to task groups; and support for package collections to the Swift package manager, SwiftPM. A package collection is a curated list of packages and associated metadata. SwiftPM now lets you subscribe to these collections, search them via the swift package-collection command-line interface, and makes their contents accessible to any clients of libSwiftPM.

Swift 5.5 is available now.


More Information

Swift Org

Related Articles

Swift 5.2 Improves Performance

Swift Adds More Generics Support

Swift 4 Improves String Handling

Swift 3.0 Released!

Apple Launches Swift Playgrounds

Apple Open Sources Swift

Apple's New Language - Swift       

Swift 2 To Be Open Source       


To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.


Grafana 11 Improves Metrics

Grafana Labs, creators of the Grafana open-source metrics analytics and visualization suite, has announced the preview release of Grafana 11 with improvements to make it easier to view metrics, and ch [ ... ]

JetBrains Updates IDEs With AI Code Completion

JetBrains has launched the first set of updates for 2024 of its JetBrains IDEs. The new versions include full-line code autocompletion powered by locally run AI models.

More News

raspberry pi books



or email your comment to: comments@i-programmer.info

Last Updated ( Tuesday, 05 October 2021 )