Apple has officially released the next iteration of its Swift programming language, it’s now on version 4. The new major update builds on Swift 3’s strengths and is source code compatible with the previous release. Swift 4 aims to deliver greater robustness and stability, it comes with improvements to the standard library, and adds features such as archival and serialisation.
Swift 4 brings with it a faster and easier to use String implementation that keeps Unicode correctness and adds support for creating, using ad managing substrings, it improves programmers’ ability to create, use and manage Collection types, it supports archival of struct and enum types and enables type-safe serialisation to external formats including JSON and plist.
As mentioned earlier, Swift 4 is compatible with Swift 3, the compiler comes with two language modes, Swift 3.2 and Swift 4.0. In Swift 3.2 mode, the compiler will accept the majority of sources that built with the older compiler and updates to previously existing APIs will not appear in this mode in order to keep source compatibility intact. Apple says, too, that Swift 4 features are available in this mode.
Under Swift 4.0 mode, programmers can take advantage of all the language and API changes, but that some source migration will be needed for most projects – rest easy, though, Apple reckons that the source changes are “quite modest” compared to many previous major changes between Swift releases.
On Apple’s platforms, Swift 4 ships as part of Xcode 9 which you can find in the Mac App Store, meanwhile, Apple has kindly compiled official binaries for Ubuntu 16.10, Ubuntu 16.04, and Ubuntu 14.04 which you can download and learn to install.