Swift 5 Features

1. ABI Stability

Swift 5 is ABI Stable!

What is ABI Stability?
ABI stands for Application Binary Interface.
It enables binary compatibility between apps and libraries compiled with different Swift versions.
So far every iOS application ships its own Swift version. This is because Swift isn’t available as a part of the iOS itself.

Hence we won’t have to ship Swift with our applications anymore. This will reduce the bundle size.
Also, there will be compatibility between applications and libraries that may have been compiled with different Swift versions.

Generally, when discussing language features we fire up the Playground in our Xcode. You can do the same!

2. Raw Strings Literals

Escaping backslashes and quotes can always get frustrating.
With the new Raw String Literals, padding the strings with a # treats the quotes as they are and pads the slash with another.

6. Handle Future Enum cases

Swift requires switch cases to be exhaustive.
One way to deal with this is by using a default case.
The default case handles all the cases for which you want to handle commonly.

Future Enum cases has a syntax @unknown default:
It is used only instead of default case.
Whenever a new enum is added, this case indicates you with warning, whether you want to handle that enum case separately.

7. Compact Dictionaries

Instead of using map, reduce and filter to filter out nil or odd values, Swift 5 provides with:compactMapValues(_:)

Popular Categories

Newsletter for You

Don't miss out!

Subscribe To Newsletter

We promise not to spam you. Unsubscribe at any time.

Invalid email address

Thanks for subscribing!

JournalDev is one of the most popular websites for Java, Python, Android, and related technical articles. Our tutorials are regularly updated, error-free, and complete. Every month millions of developers like you visit JournalDev to read our tutorials.

JournalDev was founded by Pankaj Kumar in 2010 to share his experience and learnings with the whole world. He loves Open source technologies and writing on JournalDev has become his passion.