Open Source Updates for Swift Projects - Issue #11

Time for the 11th issue of the bi-weekly newsletter “Open Source Updates for Swift Projects”

Do you notice some layout changes? That's because the newsletter migrated from Revue (which will shut down end of January 2023) to a new platform => beehiiv.com

Swift 5.7.2

In December, Xcode 14.2 was released and ships with Swift 5.7.2 !

To answer the question "What changes are included in Swift 5.7.2" you have to understand that the Swift language is managed as a collection of projects, each with its own repositories. The current list of projects includes:

  • The Swift compiler

    • The main Swift repository contains the source code for the Swift compiler and standard library, related components such as SourceKit (for IDE integration), the Swift regression test suite, and implementation-level documentation.

    • The Swift driver repository contains a new implementation of the Swift compiler’s “driver”, which aims to be a more extensible, maintainable, and robust drop-in replacement for the existing compiler driver.

  • The standard library bundled as part of the language

  • The LLDB debugger which includes the Swift REPL

  • The Swift package manager for distributing and building Swift source code

  • Xcode playground support to enable playgrounds in Xcode.

Some of the repositories have CHANGELOG files. Nevertheless, I found it interesting to glance at the commit messages by comparing the release tags, e.g.

No significant changes as Swift 5.7.2 is a patch release but if you were waiting for certain fixes you could easily check, with the method above, if the necessary changes found their way into Swift's latest release.

Understanding SwiftUI view lifecycles

Ole Begeman wrote an app called SwiftUI View Lifecycle. The app allows you to observe how different SwiftUI constructs and containers affect a view’s lifecycle, including the lifetime of its state and when onAppear gets called. The code for the app is on GitHub. It can be built for iOS and macOS.

Use modern SwiftUI Navigation APIs on older iOS versions

NavigationBackport is a dependency-free Swift package that uses the navigation APIs available in older SwiftUI versions (such as NavigationView and NavigationLink) to recreate the new NavigationStack APIs introduced in WWDC22 so that you can start targeting those APIs on older versions of iOS, tvOS, and watchOS.

RichText

RichTextKit is a Swift-based library that lets you edit rich text in UIKit, AppKit, and SwiftUI. It has a multi-platform RichTextView and a SwiftUI RichTextEditor and supports changing style (bold, italic, underline etc.), font, font sizes, colors, text alignment, etc. You can even drag in and paste images if you use a data format that allows it.

Happy Holidays!