Code

Swift 5.1 offers module stability for binary frameworks

Update introduces features for library evolution and compiler and library improvements
Pro
Image: Stockfresh

27 September 2019

Swift 5.1, an upgrade to Apple’s general-purpose language built as a replacement for C-based languages, introduces module stability. Module stability allows Swift developers to create binary frameworks that will work with future releases of the language.  

Swift 5.1 introduces a new text-based module interface file that describes the API of a binary framework, allowing for compilation of Swift code using different compiler versions. Swift 5.1 also includes property wrappers that introduce a general-purpose syntax for defining custom access patterns for property values including thread-specific storage, atomic operations, delayed initialisers, and copy-on-write behaviour.

Other new capabilities and improvements in Swift 5.1 include:

 

advertisement



 
  • Support for a library evolution build mode, which allows developers to make certain changes to types without breaking the library’s ABI. Developers can opt out of this feature on a per-type basis.
  • Updates to the standard library including support for handling and updating diffs on collections and appropriate types, greater flexibility for accessing an array, and more APIs for working with Strings. API improvements were made for working with SIMD types including support for extending vectors. The standard library also adds an identifiable protocol for entities requiring unique identifiers.
  • The return keyword is no longer needed for single expression functions or getters.
  • Opaque result types enable the use of a generic type to support different types conforming to the same protocol or to hide implementation details in APIs.
  • Self can be used for value types and classes.
  • The compiler now synthesises default values for properties with default initialisers.

You can download Swift 5.1 from swift.org.

IDG News Service

Read More:


Back to Top ↑

TechCentral.ie