Swift 5.4 | New Features and Updates
Swift is the preferred programming language for the Apple ecosystem. It’s a safe, fast, and interactive option that combines the best in Apple’s engineering culture and the contributions from its open-source community.
With the Swift 5.4 update, there is a significant improvement in the compilation, result builders entry, better code completion in expressions, and so on. Let’s see all the major updates that this new release has in store for us.
Function builders were unofficially a part of Swift 5.1. With this update, they are now formally here named as result builders.
New result builders can now be defined with the help of new structs via @resultBuilder. This attribute informs SwiftUI which type to be considered as a result builder. However, all result builders need to define at least one static function.
Implicit member syntax extension
There is an improved way of using implicit member expressions. There is now support for chains of static functions as opposed to a single static member earlier. The compiler can comprehend multiple chained members and act accordingly.
Multiple variadic parameters in functions
Before this update, you had just one variadic parameter. To elaborate, there is now the possibility to use multiple variadic parameters in functions, subscripts, initializers, and methods. The only condition here is that all these parameters should have labels.
For example, now one can create a function that will store which team won a particular football match and followed by a second parameter that will store the names of the players that scored the maximum touchdowns.
Changes in local functions
Local functions now have overloading support. Meaning, nested functions can be overloaded and Swift can select which one gets to run based upon the types that are in use.
Support for property wrappers
Introduced in 5.1, property wrappers were implemented to attach extra functionality to properties easily. This is now extended to include support for local variables too.
All the changes mentioned above are well-received in the developers’ community so far. Do let us know which upgrade are you liking the best and which updates/ features are missing in your opinion.
About Galaxy WeblinksWe specialize in human-centric user experience design services to our clients across the globe. Our innovative ideas, creative designs, industry best practices, and processes help us improve user satisfaction and solve complex design problems. Contact us for a free consultation!
Developing apps for iOS and Android using one code base is a tempting proposition. With the introduction of React Na...
The timing of this Apple’s urgent security update is sure to raise some questions as it’s happening in the same time...
Apple in its annual WWDC made some game changing announcements like a new Mac Pro, an exclusive OS for iPad, iOS 13 r...