Swift 4.2 Released!

Swift 4.2 is now officially released! Swift 4.2 builds on the strengths of Swift 4, delivering faster compile times, improving the debugging experience, updating the standard library, and converging on binary compatibility.

You can watch a quick overview of it by watching the WWDC 2018: What’s New in Swift presentation, and try out some of the new features in this playground put together by Ole Begemann.

Language updates

Swift 4.2 is a major language release and contains the following language changes and updates that went through the Swift Evolution process:

Generics improvements

With the completion of conditional conformance support, Swift 4.2 makes significant progress in implementing the vision of generics in the language. Better support for generics ultimately reduces the amount of boilerplate needed in your code and make more of your code reusable. To learn more about conditional conformance, see more at:

Watch the Swift Generics WWDC 2018 presentation for more details.

Standard Library updates

The standard library in Swift 4.2 includes a number of new features, including improvements to the Hashable protocol as well as a new unified set of randomization functions and protocols.

See more at:

Binary compatibility

Swift 4.2 brings the language closer towards a stabilized ABI, enabling binary compatibility for future releases of Swift. Visit the ABI Dashboard for more details on the current progress of this effort.

Additional language and compiler updates

Swift 4.2 includes a number of improvements that have a noticable impact on developer experience, including:

Swift 4.2 also implements the following language proposals from the Swift Evolution process:

Package Manager Updates

Swift 4.2 introduces new features for the Swift Package Manager:

Swift 4.2 also implements the following Package Manager proposals from the Swift Evolution process:

Migrating to Swift 4.2

Swift 4.2 is source compatible with Swift 4, Swift 4.1 and Swift 3. Swift 4.2 will be the last release to provide source compatibility with Swift 3.

To help with moving to Swift 4.2 from earlier releases of Swift, Apple’s Xcode 10 contains a code migrator that can automatically handle many of the needed source changes. There is also a migration guide available to guide you through many of the changes — especially through the ones that are less mechanical and require more direct scrutiny.

Documentation

An updated version of The Swift Programming Language for Swift 4.2 is now available on Swift.org. It is also available for free on the Apple Books store.

Platforms

Linux

Official binaries for Ubuntu 18.04, Ubuntu 16.04 and Ubuntu 14.04 are available for download.

Apple (Xcode)

For development on Apple’s platforms, Swift 4.2 ships as part of Xcode 10.

A toolchain is also available for download from Swift.org.

Sources

Development on Swift 4.2 was tracked in the swift-4.2-branch on the following repositories on GitHub:

The tag swift-4.2-RELEASE designates the specific revisions in those repositories that make up the final version of Swift 4.2.

The swift-4.2-branch will remain open, but under the same release management process, to accumulate changes for a potential future bug-fix “dot” release.