Tuesday, April 27, 2021

Swift 5.4 Released

Ted Kremenek:

Swift 5.4 includes the following new language features:

  • Support for multiple variadic parameters in functions, subscripts and initializers (SE-0284)
  • Extend implicit member syntax (SE-0287)
  • Result builders (SE-0289)
  • Local functions supporting overloading
  • Property wrappers for local variables


In Swift 5.4, protocol conformance checks at runtime are significantly faster, thanks to a faster hash table implementation for caching previous lookup results. In particular, this speeds up common runtime as? and as! casting operations.

This was slow enough that in a few cases I had worked around it by using an extension to introduce an instance method to do the test.

The Swift compiler is much better at tracking dependencies between files, resulting in a significant reduction in the number of files compiled for many kinds of changes during incremental builds

Dependencies on member variables and functions of structs, enums, classes, and protocols are now tracked individually by the Swift compiler. This finer granularity speeds and shrinks rebuilds after changes to these entities

There are code completion and type checking improvements, too.


Update (2021-05-19): John Sundell:

It’s now possible to create a local variable that’s assigned to an expression that has the same name, without having to manually disambiguate with self.

That was a common annoyance for me.

Comments RSS · Twitter

Leave a Comment