Discover some New Features of Swift 5.7


You’re more of a video kind of person? I’ve got you covered! Here’s a video with the same content than this article 🍿


You’re curious about the new features of Swift 5.7, but haven’t had time to check them out? 😔

Don’t worry: I’ve got you covered!

In a few paragraphs, I’ll share with you some of my favorite new exciting features of Swift 5.7 🔥

Let’s start with a new shorter syntax for unwrapping optionals!

When we write an if-let statement, we no longer have to create an extra variable to store the unwrapped value 👌

And this new syntax also applies to guard-let statements:

And yes, it also works for the very common `guard let self = self` pattern 🙌

Swift 5.7 also features a new literal syntax for writing regular expressions!

We can use it, for instance, to extract data from a piece of text 📝

And there’s also an alternate builder-based syntax for when you need to write more complex regular expressions!

Finally, protocols with associated types have become much easier to handle!

They can now be used to type both variables and arguments, all thanks to the keywords `some` and `any` 🔥

And these are the 3 new features of Swift 5.7 that I wanted to share with you ✌️

But trust me: we’ve barely scratched the surface, because this new version of Swift is really packed with a lot of cool new features 🤩

So I really recommend that you take the time to read the official release note on Swift's official blog 🤓

Previous
Previous

Discover how Mocks work in Swift

Next
Next

Discover the MVP Architecture