HeadlinesBriefing favicon HeadlinesBriefing.com

Swift 6.4 Released: New Features and Improvements

Hacker News •
×

September 15, 2026 Swift 6.4 is now available. Swift aims to be a great choice across the stack, from apps and servers to systems code, embedded devices, and the browser. This release deepens that support, and makes everyday code easier to write.

Highlights include: Swift Build is now the default in Swift Package Manager, so your projects build the same way on Linux, mac OS, and Windows. Subprocess reaches 1.0, a stable, cross-platform way to run and interact with other programs from Swift, from command-line tools to streaming processes. Interoperability reaches further, with Swift’s Span now bridging directly with C++20’s std::span, and Swift/Java interop extending its async and callback support.

Swift runs faster in the browser, with Web Assembly bridging through Java Script Kit up to 40 times faster, and the Wasm SDK available directly from Swift.org. Embedded Swift grows more capable, with support for existential types and richer error handling for microcontroller-class targets. Performance improves while maintaining memory safety, with new array types that hold non-copyable elements without copy-on-write overhead, and the new Iterable protocol for iterating without copies.

Simpler and clearer code Swift 6.4 streamlines your day-to-day programming to make your code simpler and clearer. More natural optional some and any types. When writing an optional some or any type, you no longer have to wrap the type in parentheses.

Instead of (some Rocket)?, you can simply write some Rocket? (SE-0521). Source-level control over compiler warnings. When you need to control the behavior of warnings in your project, such as suppressing warnings or promoting them to errors, you can now define the warning behavior directly in your code using the new @diagnose attribute (SE-0522).

Clarify which API to use when multiple libraries conflict. When multiple modules define the same API name that you want to reference, you can specify which module you meant to use through module selectors. If your app imports two modules that both provide a type Common Thing, using the :: selector lets you clearly specify which of those you intend (SE-0491).

Call async functions in a defer block. Any asynchronous code you write in a defer block is awaited and runs to completion before it exits (SE-0493). Ensure that necessary cleanup work isn’t cancelled.

You can run a closure that’s shielded from the enclosing task’s cancellation through the with Task Cancellation Shield API (SE-0504). You can combine asynchronous calls in defer blocks and cancellation shields to make sure that cleanup work always happens, no matter how the function returns:func process File(at url: URL) async throws {let handle = try File Handle(for Reading From: url)defer {// flush Metrics is a network call, so it can suspend after cancellation// is requested; the shield ensures it runs to completion and isn't// included in cancellation.await with Task Cancellation Shield {await flush Metrics(for: url)try? handle.close()}}try await process Contents(of: handle)}Improvements to Foundation and the standard library make it easier to use modern APIs with existing types. For example, Progress Manager added API to provide async/await support (SF-0023), and @Observable types now have fine-grained and continuous change notifications (SE-0506).

The Subprocess library — originally introduced as SF-0007 and released as an initial 0.1 version in 2025 — has reached 1.0. It provides a cross-platform package to run and interact with subprocesses, built from the ground up using Swift concurrency. The following example, from Getting Started with Subprocess, illustrates running a process and capturing its output.let result = try await Subprocess.run(.name("ls"),arguments: ["-la"],output: .string(limit: 4096))Swift 6.4 makes it easier to migrate existing projects to use S...