Swift 5.2 Improves Performance
Written by Kay Ewbank   
Tuesday, 11 February 2020

Swift 5.2 is now available in a beta version with improvements including smaller code size and more efficient memory use, alongside better error diagnostics.

Swift was launched by Apple in 2014 as an easier alternative to Objective C. It incorporates some of the best ideas from languages such as C# and JavaScript, and aims to be easy to use. It was made open source by Apple in 2015, and a Linux build was added at that point.

swiftlogo
 
 Alongside the improvements to size and memory use, Swift 5.2 adds a new diagnostic architecture designed to improve the precision of error messages issued by Xcode. In earlier releases of Swift, the type checker used to guess the exact location of an error, and when it got it wrong this resulted in unclear error messages. The new diagnostic infrastructure works differently.  Instead of guessing where an error occurs, the type checker attempts to fix problems at the point where they are actually encountered, while remembering the fixes it has applied. The developers say this not only allows the type checker to pinpoint errors in more kinds of programs, it also allows it to surface more failures where previously it would simply stop after reporting the first error.
 
Swift 5.2 also adds a couple of minor language improvements, starting with the ability to call some types as though they were functions, making Swift's support for functional programming stronger.  Swift developers were already able to pass the instance methods of any types as functions, but the new support means types can be called as though they were functions.
 
The second language improvement is the ability to pass key paths as functions. This could be used instead of having to use a
closure to extract data from a property. Instead of this, you can now pass that property’s key path directly
 
 
swiftlogo

More Information

Swift Org

Related Articles

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       

Top Languages 2015 - Stasis But For Go And Swift   

 

 

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


Remembering Grace Hopper On Her 114th Anniversary
09/12/2024

Today sees the start of Computer Science Education Week and  the 2024 Hour of Code. These educational event are timed to coincide with Grace Hopper's birthday on January 9th, 1906 due to her conc [ ... ]



Hour Of Code 2024 Is About To Kick Off
04/12/2024

This year the event that aims to provide a coding experience for all school students and anyone else who wants to join in runs between December 9th and 15th and includes new activities. Let's find out [ ... ]


More News

espbook

 

Comments




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