Ted Kremenek is a member of the Swift Core Team and manages the Languages and Runtimes group at Apple.
Swift 5 is now officially released!
Swift 5 is a major milestone in the evolution of the language. Thanks to ABI stability, the Swift runtime is now included in current and future versions of Apple’s platform operating systems: macOS, iOS, tvOS and watchOS. Swift 5 also introduces new capabilities that are building blocks for future versions, including a reimplementation of String, enforcement of exclusive access to memory during runtime, new data types, and support for dynamically callable types.
You can try out some of the new features in this playground put together by Paul Hudson.
Table of Contents
Language Updates
Stable ABI and Binary Compatibility
The ABI is now declared stable for Swift 5 on Apple platforms. As a result, the Swift libraries are now incorporated into every macOS, iOS, tvOS, and watchOS release going forward. Your apps will be easier to build and smaller because they won’t have to include those libraries.
See these blog posts for more details:
Standard Library Updates
The standard library in Swift 5 includes the following new features:
- String reimplemented with UTF-8 encoding which can often result in faster code (See the UTF-8 String blog post for more background on this change)
- Improved support for raw text in string literals (See the String Literals blog post for more background on this refinement)
- Result and SIMD vector types added to the Standard Library
- Enhancements to String interpolation, adding more flexibility to construct text from data
- Performance improvements to Dictionary and Set
Swift 5 implements the following Standard Library proposals from the Swift Evolution process:
Additional Language and Compiler Updates
Swift 5 defaults to enforcing exclusive access to memory for both debug and release builds (See the Swift 5 Exclusivity Enforcement blog post for more information about this update). And Swift 5 supports dynamically callable types that help improve interoperability with dynamic languages such as Python, JavaScript and Ruby.
Swift 5 also implements the following language proposals from the Swift Evolution process:
Package Manager Updates
Swift Package Manager includes a number of new features in Swift 5, including dependency mirroring, target-specific build settings, customized deployment targets, and the ability to generate code coverage data. Additionally, the swift run
command now includes the ability to import libraries in a REPL without needing to build an executable.
Swift 5 implements the following Package Manager proposals from the Swift Evolution process:
Migrating to Swift 5
Swift 5 is source compatible with Swift 4, Swift 4.1 and Swift 4.2.
To help with moving to Swift 5 from earlier releases of Swift, Apple’s Xcode 10.2 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 5 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 5 ships as part of Xcode 10.2.
A toolchain is also available for download from Swift.org.
Sources
Development on Swift 5 was tracked in the swift-5.0-branch on the following repositories on GitHub:
The tag swift-5.0-RELEASE
designates the specific revisions in those repositories that make up the final version of Swift 5.
The swift-5.0-branch
will remain open, but under the same release management process, to accumulate changes for a potential future bug-fix “dot” release.
Leave a Reply