Interested in learning what's next for the gaming industry? Join gaming executives to discuss emerging parts of the industry this October at GamesBeat Summit Next. Learn more.
A new premium TV offering (Apple TV+), news and magazine subscription service (Apple News+), and credit card (Apple Card) weren’t the only things Apple unveiled today. In a blog post on Swift.org, Ted Kremenek, manager of the languages and runtimes team at Apple, announced that the newest release of Apple’s compiled programming language for iOS, macOS, watchOS, tvOS, Linux, z/OS, and other platforms is now officially available, following support in the February beta release of Xcode 10.2 and the debut of Swift Playgrounds 3.0.
Swift 5 is source compatible with Swift 4, Swift 4.,1 and Swift 4.2, and Xcode 10.2 has a code migrator that can automatically handle some of the necessary source changes. Official binaries for Ubuntu 18.04, Ubuntu 16.04, and Ubuntu 14.04 are available for download, as well as a toolchain, and Apple has released an updated version of the Swift Programming Language guide on Swift.org.
For the uninitiated, the Swift programming language is designed to work with Apple’s Cocoa and Cocoa Touch framework and the existing Objective-C code written for Apple products like the iPhone, Apple TV, and iPad. It’s built with the LLVM compiler framework and debuted with Xcode 6 in 2014, and it uses the Objective-C runtime library, which allows it to run alongside C, Objective-C, and C++ in one program.
So what does Swift 5 bring to the table? ABI stability is perhaps the highlight — it enables binary compatibility between apps and libraries compiled with different versions of Swift, even when using the compatibility mode with older languages. (For example, an app built with Swift 5 will run on systems that have a Swift 5 standard library installed, as well as those with a hypothetical Swift 6.) Furthermore, the Swift runtime and standard library now shift with the OS, obviating the need for apps deployed to upcoming OS releases to embed the standard Swift library and overlay libraries within the app bundle.
As of now, Swift has declared ABI stable on macOS, iOS, watchOS, and tvOS.
A related new feature is module stability, which enables clients to use libraries without having to worry about the compiler with which they were built, and library evolution, which allows developers to ship a new version of a library without having to recompile their clients. Thanks to app thinning, Swift apps on devices running iOS 12.2, watchOS 5.2, and tvOS 12.2 no longer include dynamically linked libraries for the standard library and Swift SDK overlays, resulting in smaller package sizes and faster launch times.
Also in tow with Swift 5’s standard library is improved support for raw text in string literals (sequences of characters from the source character set that represent a string value) and result and SIMD vector types, plus enhancements to string interpolation (the process of evaluating a string literal containing one or more placeholders) and performance improvements to dictionaries and sets. Swift 5 also switches the preferred encoding of ASCII and Unicode-rich strings from UTF-16 to UTF-8, which Apple says can result in an up to 50 percent reduction in memory usage.
For a full list of changes, check out the release notes on Swift.org.
VentureBeat's mission is to be a digital town square for technical decision-makers to gain knowledge about transformative enterprise technology and transact. Learn more about membership.