What’s new in Swift 5.3?

Tram Ho

For those of you doing iOS, you are probably too familiar with updating the latest versions of iOS, swift, xcode. In this article we will learn about what is new on Swift 5.3 – the latest verison of the Swift language.

Let’s find out together!

Multi-pattern catch clauses

In this swift version, we were able to catch many error cases inside the error handling process, helping us to limit a lot of duplication. For example: When dealing with temperature error capture in the code below:

Multiple trailing closures

Let’s observe the two writing below to see clearly on Swift 5.3 everything becomes simpler and clearer

Synthesized Comparable conformance for enums

With Comparable we can use <,> and = comparisons to compare enum instances:

self is no longer required in many places

This swift version allows us in some cases to not need to write seft if we get an error before, let’s see the following example:

We don’t need to write self.cell anymore but cell is enough instead:

Type-Based Program Entry Points

We have the main property and we will not need to create instant then call the method and call it directly as below:

instead would be

Conclude

Swift 5.3 has added some interesting properties, the Swift language is getting better, easier and more compact.

Thank you for your time!

Source:

https://www.hackingwithswift.com/articles/218/whats-new-in-swift-5-3

Share the news now

Source : Viblo