The holiday season is just around the corner. Most of us enjoy Thanksgiving right before Christmas. For others, the festivities start after Christmas and continue even after New Year’s Eve. Despite the differences, we should all enjoy some time off with our families and friends and for this period, merge access will be locked down in Swift. Check out the holiday schedule and plan your work accordingly.

There is a new feature in Xcode 13.2 beta which makes build times much faster by using more CPU cores. This new build system is opt-in, so you’ll have to enable it.

Before we jump into other detailed news, I would like to express my gratitude to our sponsors who have helped us to run this project for the rest of the year. We would not be here without your support.

Podcasts

In episode 108 of the Swift by Sundell podcast, Marin Todorov, joins John Sundell. They discuss Swift’s new concurrency system and its newly announced backward compatibility, his new book about that topic, and his work on Apple’s open source documentation tool, Swift-DocC.

News and community

Nicole Jacque updated us about the Swift 5.6 release process.

Mishal Shah informed us about updating llvm-project branch for swift:main.

John Sundell announced CollectionConcurrencyKit - a lightweight Swift package that adds asynchronous and concurrent versions of the standard map, flatMap, compactMap, and forEach APIs to all Swift collections that conform to the Sequence protocol. He wrote an article explaining how to build async and concurrent versions of forEach and map.

Steven Van Impe introduced Swift in higher education.

Mishal Shah informed us about the Holiday Schedule for Swift projects.

Leonardo Maia Pugliese wrote an article explaining linked lists using recursion.

Antoine van der Lee explained property wrappers in Swift in a blog post.

Accepted proposals

SE-0326 Multi-statement closure parameter/result type inference was accepted.

Returned proposals

SE-0327 has been returned for revision.

The review discussion centered on the complexity of the initialization model, and has uncovered a simpler model that should be easier to reason about. The Core Team has returned this proposal for revision to investigate this new model. Thank you to everyone who participated!

Proposals in review

SE-0329: Clock, Instant, Date, and Duration is under review.

The concepts of time can be broken down into three distinct parts:

  1. An item to provide a concept of now plus a way to wake up after a given point in time
  2. A concept of a point in time
  3. A concept of a measurement in time

These three items are respectively a clock, an instant and a duration. The measurement of time can be used for many types of APIs, all the way from the high levels of a concept of a timeout on a network connection, to the amount of time to sleep a task. Currently, the APIs that take measurement of time types take NSTimeInterval (aka TimeInterval), DispatchTimeInterval, and even types like timespec.

Swift Forums

Ilias Karim started a discussion about adding notContains to the standard library.

Filter using keypath notation makes functional programming much more succinct and readable in Swift.

However, there is not an intuitive standard library way to filter by the opposite of the boolean. I previously proposed .toggled or .isFalse and was met with reasonable push back.

Karl proposed two minor additions to RandomNumberGenerator.

  1. Filling buffers
  2. Static member syntax

Richard Wei pitched an idea about strongly typed regex captures.

Capturing groups are a commonly used component of regular expressions as they allow the programmer to extract information from matched input. A capturing group collects multiple characters together as a single unit that can be backreferenced within the regular expression and accessed in the result of a successful match.

Joseph Heck started a discussion about the terminology questions - behaviors, shells, and possible reductions.

I’ll caveat this with “Yep, these could be all implementation details”. In starting to dig through the source for swift-distributed-actors, there are some things I knew the concepts for (basic actor concept, mailboxes, and messages). The distributed actors code steps it up a bit, and uses some terms and phrasing that I wasn’t very familiar with. I could guess and infer quite a bit, but I thought it might be best to ask about the specific terms and how they’re inter-related.

Ethan Kusters addressed improvements for the presentation of non-framework documentation.

Not all documentation built by Swift-DocC is for frameworks. Today, Swift-DocC will build documentation for any symbol graph input it is provided, which is what allows for custom workflows like Swift-DocC’s user documentation on Swift.org. However, Swift-DocC always describes this documentation as a “Framework” on the top-level page, regardless of the contents of that symbol graph.

For example, Swift-DocC’s user documentation on Swift.org is currently described as a “Framework” on the top-level page when the documentation on that page is about using DocC as a “Tool”, not as a “Framework”.

Tom Doron pitched a SwiftPM manifest based on result builders.

Swift Package Manager (here after SwiftPM) was released when Swift was made open source in 2016. SwiftPM uses a file named Package.swift with which users describe the package’s source structure, the build artifacts such as any executables or libraries the build produces, and any dependencies on other packages.

SwiftPM’s manifest is a Swift program (a script of sorts) which SwiftPM builds and executes as a separate process in a security sandbox to generate a static data model representing the desired package configuration. Currently, the static representation is based on JSON and the exact format of that JSON is an internal implementation detail. The JSON model is later deserialized and loaded into the parent process memory space, driving SwiftPM’s workflows such as the dependency resolution, build, test , etc.

Konrad ktoso Malawski shared a proposal to implement distributed actor isolation.

This proposal is focusing only on the isolation rules necessary to support distributed actors, and is split out from the large overall Distributed Actors pitch 8. Our intent is to propose the various pieces of that very large pitch, as individual yet interconnected proposals, similar to how Swift Concurrency was introduced last year. This way we hope to keep the amount of content reviewable, and also discussions focused on the specific topics at hand.

Holly Borla pitched a proposal introducing existential any.

Existential types in Swift have an extremely lightweight spelling: a plain protocol name in type context means an existential type. Over the years, this has risen to the level of active harm by causing confusion, leading programmers down the wrong path that often requires them to re-write code once they hit a fundamental limitation of value-level abstraction. This proposal makes the impact of existential types explicit in the language by annotating such types with any.

Finally

What’s a good way to model a numeric value that must be within a certain range?.

Sprite Commercial in the Style of a 1993 MacIntosh computer.