What’s new in Apple’s Swift 5 language

The latest version of the MacOS and iOS programming language enables slimmer apps, better interoperability

What’s new in Apple’s Swift 5 language
Stefan Berndtsson (CC BY 2.0)

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:

  • Dynamically callable types are supported to improve interoperability with languages such as JavaScript, Python, and Ruby.
  • 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 Unicode.Scalar type.
  • 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 Result type, 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.
  • The swift run command can import libraries in a read-event-print loop (REPL) without having to build an executable.

Where to download Swift 5

You can download Swift binaries for Linux from Swift.org. It also is available as part of the Apple Xcode 10.2 IDE, which is available from from the Apple Mac App Store.

Copyright © 2019 IDG Communications, Inc.