Swift, the programming language for macOS and iOS, has just released a new update. According to the team behind the language, Swift 5.2 focuses on improving developer experience, with improved compiler diagnostics and code completion, debugging reliability, handling of dependencies, and tooling. 

Swift developer John Sundell wrote that “while Swift 5.2’s total number of new language features might be relatively small, it does include two new capabilities that could potentially have quite a big impact on Swift’s overall power as a functional programming language.”

RELATED CONTENT: The Swift programming language’s roadmap to version 6

According to the Swift team, in previous versions of Swift, the compiler tried to guess the exact location of errors by breaking up expressions and searching for failures separately in each subsection. While this worked well in some cases, there were numerous errors that this strategy could not detect. 

Improvements to code completion include faster completion by eliminating unnecessary type checking, the ability to supply names of implicit members for incomplete dictionary literals and incomplete ternary expressions, and easier to read types. 

This release also improves build algorithms. According to the team, the compiler supports two modes of operation: whole module and incremental. It is improving incremental builds by letting the compiler leverage centralized logic for caching, lazy evaluation, and dependency tracking between requests. “In Swift 5.2, the internal representation of declarations in the compiler is immutable, and the code generation phase of the compiler is able to trigger lazy evaluation of requests, the result of which are cached. Since requests are more fine-grained than the old validation step, this improves performance by avoiding wasted work. It also improves correctness, fixing a significant number of correctness issues where the type checker did not anticipate needing to validate something that was later required for code generation,” Ted Kremenek, member of the Swift Core Team and manager of Languages and Runtimes at Apple,  wrote in a post

Debugger improvements include making LLDB more resilient in reconstructing type information from debug information. This will provide the debugger with the ability to use more information abot Swift types, the team explained.

Other tooling improvements include updates to Swift Package Manager, SwiftSyntax, and Language Server Protocol. 

In addition to those developer experience improvements mentioned above, a few new capabilities have been added that offer new ways to build expressive APIs.

More information is available here