Apple: Swift 5.2 programming language released – Xcode 11.4 and faster code completion
Apple has released version 5.2 of its widely used Swift programming language for writing apps for Mac, iPad, iPhone, Apple Watch, and Apple TV.
Apple’s open-source Swift 5.2 programming language arrived with the release on Tuesday of Xcode 11.4, the latest version of Apple’s Integrated Development Environment (IDE). Swift 5.2 builds on Swift 5.1, released in September, and Swift 5 from March 2019.
Xcode 11.4 allows developers to distribute macOS apps as a âuniversal purchaseâ with the iOS version of the same app. Once the developers embrace it, it will allow users to make a single in-app purchase that applies to macOS, iOS, iPadOS, watchOS, and tvOS devices.
The prospect of universal purchases for macOS prompts developers to build apps with Mac Catalyst, Apple’s platform to help developers deliver iPadOS apps to its 100 million Mac users. Universal Purchase is enabled by default for new Mac Catalyst apps created in Xcode 11.4.
SEE: How to Build a Successful Developer Career (Free PDF)
Swift Core Team member Ted Kremenek said Swift 5.2 âsignificantlyâ improves compiler diagnostics with better quality and more accurate error messages.
It also offers faster code completion, increased debugging reliability, improved dependency management in Swift Package Manager, and tool enhancements with Language Server Protocol (LSP) and SwiftSyntax.
Swift 5.2’s code completion feature works up to 1.2 to 1.6 times faster for large files compared to Xcode 11.3.1, according to Kremenek.
Swift 5.2’s new compiler diagnostic engine resolves potentially confusing error messages reported in Swift 5.1 code and is now better able to identify the exact piece of code that needs to be fixed.
It also promises more efficient creation of incremental builds, the mode in Xcode to compile builds to debug a Swift project.
“To minimize the waste of work done by incremental versions, the Swift 5.2 compiler – including the type checker – leverages new centralized logic for caching, lazy evaluation, and dependency tracking between requests, where a demand is an autonomous unit of computation, ânotes Kremenek.
“This logic is now used by the compiler to more efficiently resolve declarations and their references to each other.”
Kremenek suggests that further performance optimizations of Swift 5.2’s compiler behavior should also improve Xcode’s Whole Module mode, which is used for release builds.
LLDB, Xcode’s default open source debugger, is now better at reconstructing type information for Swift programs from debug information.
LLDB can also now import C and Objective-C types from debug information in DWARF format, instead of compiling the Clang module from source code, notes Kremenek.
The Swift Package Manager in Swift 5.2 improves the resolution of package dependencies. These should reduce the risk of dependency version conflicts and improve the quality of error messages, while providing better performance in complex package graphics.
SEE: It’s all about ports: what Apple needs to change now that Jony Ive is gone
Finally, there are updates to the SourceKit-LSP implementation of the Language Server Protocol (LSP) for the Swift and C languages. Microsoft created LSP, a client-server protocol, to incorporate features such as semi-typing. Automatique.
Xcode 11.4 and its command line tools package include Swift 5.2 SourceKit-LSP, which now supports the FixIts LSP feature so that Swift errors, warnings and notes with FixIts are taken care of using actions from LSP code.
Swift now also supports LSP local refactoring, which means Swift local factorizations such as extract to method are now supported using the code action type “Refactoring”, according to Kremenek.