If you like this article, considere buy me a cofee! 😉
Crypto donation button by NOWPayments

What is new in Swift 5.3 (whose publication process was announced by Apple on 3/25) can be found both at the code level (multi-pattern catch, multiple trailing closure …) and in the use of Swift Package Manager (addition of binary dependencies or resources. Below I detail some of the new features in Swift 5.3 (keep in mind that we expect to see the new beta of Swift 5.3 at WWDC20, although to test it you can download it at Swift.org).

Synthesized Comparable conformance for enums (SE-0266)

Thanks to this new addition, we can adopt the Comparable protocol in enums that do not have associated values, or that do have them and they adopt the Comparable protocol. With this, what is achieved is to be able to compare two cases of the same enum using, for example, > or <.

Use where on contextually generic declarations (SE-0267)

What is looking for with this modification is to remove the restriction of attaching where clauses to member declarations that can only refer to external generic parameters. For example:

With Swift 5.3 it can be expressed as:

Redefinition of didSet semantics (SE-0268)

Prior to Swift 5.3, when using didSet in a property, the getter was always called to obtain the oldValue of that property (although this value was not referenced), with the consequent performance impact. In Swift 5.3 the efficiency of the process has been increased, since now the oldValue is not accessed if we are not calling it inside didSet.

Self use in closures is eliminated if no reference cycles are given (SE-0269)

Until now, inside closures it was necessary to use self explicitly, even if reference cycles were not going to occur. For example:

With Swift 5.3 self can be removed:

Multi-Pattern Catch Clauses (SE-0276)

Until now, Swift only allowed the use of one error type per catch block, allowing us to reduce duplicate code in error handling. That is to say:

Now with Swift 5.3 we can merge both errors into a single catch block:

A new Float16 type (SE-0277)

In Swift 5.3 this new type is added due to its widespread use in mobile graphics, HDR images and Machine Learning.

Multiple-trailing closures (SE-0279)

A trailing closure refers to the fact that the last parameter of a function in Swift is a closure. In this case, Swift allows you to pass this closure directly inside the brackets instead of as a parameter:

With Swift 5.3 this option is not limited to the last parameter of the function, so now we have to add multiple closures to our functions (simply by adding new labels):

Swift Package Manager improvements

For those of us who use Swift Package Manager to create and import Swift packages, Swift 5.3 presents some very interesting improvements:

  • Package Manager Resources (SE-0271). Now Swift packages can incorporate resources (images, audio …). But not only that, but certain rules may be applied to process these resources.
  • Package Manager Binary Dependencies (SE-0272). You can use dependencies in binary format, such as Firebase or GoogleAnalytics.
  • Conditional dependencies (SE-0273). This option will allow specifying which dependencies are added depending on the platform.
  • Localized resources (SE-0278). Along with the possibility of adding resources to Swift packages, they can be localized.


Swift 5.3 includes interesting improvements at the code or Swift package management level. But there are other improvements to look out for as well, such as the fact that Swift 5.3 will support platforms like Windows and new Linux distributions.

Categories: Swift


Leave a Reply

Your email address will not be published. Required fields are marked *

Follow on Feedly