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


MongoDB 8 Reduces Memory Use And Increases Speed
07/10/2024

MongoDb 8 has been released, and the developers have said this is the most secure, durable, available, and performant version of MongoDB yet, with significantly reduced memory usage and query times, a [ ... ]



NIST Password Guidelines - The Nine Commandments
01/10/2024

The US National Institute of Standards and Technology (NIST) has issued the second public draft of the proposed new version of its Digital Identity Guidelines. It includes updated rules [ ... ]


More News

kotlin book

 

Comments




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

Last Updated ( Tuesday, 05 October 2021 )