Apple has released its Swift 5 programming language, with a stable application binary interface (ABI) and binary compatibility that Apple says will result in the development of smaller applications. Interoperability with other languages is improved as well.
With this upgrade, the ABI is now stable on Apple platforms, so Swift libraries are now incorporated into every future release of MacOS, iOS, WatchOS, and TVOS. Because developers will no longer have to include these libraries, applications will now be smaller and easier to build.
Other new features in Swift 5 include:
- Swift 5 defaults to enforcing exclusive access to memory for release and debug builds. This is intended to enhance Swift’s safety.
- Swift 5 has a reimplementation of String, new data types, and enforcement of exclusive access to memory during runtime.
- In the standard library, String has been reimplemented with UTF-8 encoding instead of UTF-16, which can result in faster code. Objective-C interoperability is preserved.
- Swift 5 enhances string literals delimiters to support raw text. Single-line and multiline string literals are enabled and can contain any content.
- Unicode properties to support common and advanced text processing are added to the
- For SIMD (single instruction, multiple data) vectors, the library exposes a subset of operations on the SIMD types supported by most processors in the library.
- Performance improvements have been made to Dictionary and Set.
- The addition of a
Resulttype, to improve error-handling.
- The Swift Package Manager has target-specific build settings, dependency mirroring, customized deployment targets, and an ability to generate code coverage data.
swift runcommand can import libraries in a read-event-print loop (REPL) without having to build an executable.