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.

swiftlogo
 

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.

swiftlogo

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.

Banner


Python 3.10 Is The New Standard
06/10/2021

New Python releases come as no surprise as we all know about them during their development and many opt to use them before they are finally released. Python 3.10 has a few welcome improvements, but I' [ ... ]



DeepMind Takes On The Rain
01/10/2021

DeepMind has proved once again the outstanding prowess of  neural networks. Working with the UK Met Office it has developed a deep-learning tool that can accurately predict the likelihood of [ ... ]


More News

square

 



 

Comments




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

Last Updated ( Tuesday, 05 October 2021 )