New features

Swift 4 is here: More stability, compatibility and robustness

Jane Elizabeth
Swift 4
© Shutterstock /

Swift 4 is now available! What’s new in this programming language for iOS? This latest release promises more stability and compatibility. Let’s take a closer look!

Swift is gaining in followers and fans. And now, Swift 4 is finally available. The latest release for this intuitive programming language for MacOS, iOS, watchOS and tvOS promises even more robustness and stability. Other perks include source code compatibility with Swift 3, improvements to the standard library, and new features like archival and serialization.

What’s new in Swift 4?

Helpfully, Swift 4 is pretty backwards compatible. It’s possible to avoid modifying code when using the new version of the compiler. The compiler itself supports two language modes: Swift 3.2 and Swift 4.0.  The advantage here is that you can migrate over to 4.0 as fast as you’d like, or take your time and move one module at a time.

The Swift 3.2 setting for the compiler should accept most of the sources built with Swift 3.X compilers. However, updates to previously existing APIs won’t appear in this mode, in order to provide this level of source compatibility. On the other hand, most of the new language features available in Swift 4 will be accessible in this language mode.

SEE MORE: Why do developers choose Swift for enterprise app development?

The Swift 4.0 mode includes all the Swift 4.0 language and API changes. (Shocking, I know.) However, some source migration will be needed for many projects. The team at Swift thinks that there shouldn’t be too many source changes as compared to previous Swift releases, so that should be good.

The language mode is specified to the compiler by the -swift-version flag. This is automatically handled by the Swift Package Manager and Xcode.

Language updates

Swift 4 is a major language update. So, it’s not surprising that there are some big changes and updates.

  • Swift 4 includes a faster, easier to use String implementation that retains Unicode correctness and adds support for creating, using and managing substrings.
  • Adds improvements for creating, using and managing Collection types.
  • Swift 4 supports archival of struct and enum types and enables type-safe serialization to external formats such as JSON and plist.

Swift 5 — What to expect

It’s so tacky of us to focus on the next shiny thing like a magpie. We’ve just had a major language release – we don’t need to be looking off into the distance to see what else is on the horizon. And yet.

As we reported earlier this year, the primary focus of Swift 5 will be ABI stability for the Swift Standard Library. According to the file published on the swift-evolution repository, “ABI stability enables OS vendors to embed a Swift Standard Library and runtime in the OS that is compatible with applications built with Swift 5 or later. Progress towards achieving ABI stability will be tracked at a high level on the ABI Dashboard.”

Kremenek wrote in a message to the swift-evolution mailing list that in Swift 5, ABI stability is a *requirement*.

Whatever ABI we have at the end of Swift 5 is the ABI that we will have. ABI stability is an important inflection point for the maturity of the language, and it cannot be delayed any longer.

Although ABI stability is the center focus of Swift 5, it is only one of two pieces needed to support binary frameworks. The second half is module stability — although it is “a stretch goal for Swift 5,” even without it, the primary value of ABI stability can still be achieved.


If you’re interested, head on over to Swift now to check out the latest release!

Jane Elizabeth
Jane Elizabeth is an assistant editor for

Inline Feedbacks
View all comments