Along with springing iOS 14 on unsuspecting developers, Apple yesterday also released version 5.3 of its Swift programming language.
Swift 5.3 is available to developers from the Swift website or with the latest version of Apple’s integrated development environment, Xcode 12, which also includes SDKs for iOS 14, iPadOS 14, tvOS 14, watchOS 7, and macOS Big Sur.
Apple announced Swift 5.3 in March shortly after releasing Swift 5.2. The company is developing the language in the open, allowing developers in the Swift community to suggest new features via proposals that Apple may adopt.
SEE: Hiring Kit: Python developer (TechRepublic Premium)
Updates in Swift 5.3 aim to help developers be more productive by reducing redundant code, according to Holly Borla, an engineer on the Swift compiler team at Apple. It also includes fixes for common compiler issues that developers have experienced.
The new version of Swift improves binary code size and runtime memory usage compared with Swift 4 relative to applications written in Apple’s legacy programming language Objective-C. Apple released Swift in 2014 as a replacement to Objective-C.
“In Swift 4, the code size was about 2.3x the size of the Objective-C version. In Swift 5.3, the code size is under 1.5x the size of the Objective-C version,” notes Borla.
Additionally, the application logic code size in the open-source SwiftUI app MovieSwiftUI has been reduced by over 40% compared with Swift 5.1. And there are large improvements to heap memory use compared with Swift 5.1 and programs written in Objective-C.
“Swift applications now have lower heap memory overhead at runtime,” explained Borla. “The Swift runtime caches less information on startup to track things like protocol conformances, due to improvements in the runtime that made this caching less necessary. An application written in Swift should now use less heap memory than an otherwise-identical program written in Objective-C.”
Apple detailed these improvements at its WWDC 2020 developer conference in June where it announced Apple silicon and the Mac Mini-like Developer Transition Kit with an A12Z SoC processor running on macOS Big Sur.
SEE: Oracle’s Java 15: New features aim to keep millions away from languages like Rust, Kotlin
Swift 5.3 also brings improved code completion that’s up to 15 times faster than Swift 5.2 for repeated code-completion invocations inside function bodies. Users of Xcode and Apple’s SourceKit language server protocol should see a noticeable difference in speed.
Apple highlights improved build times thanks to compiler changes, improved compiler diagnostics to provide developers with more precise error messages, and better error messages for runtime failures while debugging applications.