Swift 6.4 - WWDC26 and OS 27 apps

What's New in Swift

The newest Swift release is a practical one for iOS 27, iPadOS 27, macOS 27, watchOS 27, tvOS 27, and visionOS 27 apps: less availability boilerplate, better async cleanup, more migration room for tests, faster Foundation, and sharper tools for high-performance code.

June 15, 2026 7 minute read WWDC26 session 262
WWDC26 Swift session artwork
Apple frames Swift 6.4 around everyday ergonomics, concurrency, and safer performance work.

Highlights

Everyday syntax

anyAppleOS collapses cross-platform availability checks into one readable line.

Async cleanup

await in defer makes asynchronous cleanup a first-class pattern.

Testing migration

Swift Testing and XCTest now interoperate better, so teams can migrate incrementally.

Performance control

Inlining, specialization, ownership, and noncopyable iteration keep moving into safer Swift.

anyAppleOS Availability

Cross-platform APIs often repeat the same version gate five times. Swift 6.4 adds a shorthand for Apple platforms, which is especially useful in code shared across iOS, macOS, watchOS, tvOS, and visionOS.

Swift 6.4 compiler
Older compiler fallback

If a package still needs to build with the OS 26-era toolchain, keep the older explicit availability list. The runtime behavior is the same; anyAppleOS is just a clearer way to express the same gate.

@available(iOS 27, macOS 27, watchOS 27, tvOS 27, visionOS 27, *)
func showStatus() {
    // Same platform policy, older spelling.
}
@available(anyAppleOS 27, *)
func showStatus() {
    // Available on Apple's OS 27 family.
}

@available(anyAppleOS 27, *)
@available(tvOS, unavailable)
func launch() {
    // Same broad gate, with one platform exception.
}

The value is not just fewer characters. It makes the policy visible: this API belongs to the OS 27 family.

Sharper Diagnostics

Apple highlighted better Swift Concurrency diagnostics and a new @diagnose attribute for library authors who want more control over warnings. The theme is steady: move more mistakes from runtime review into compiler feedback.

Swift 6.4 compiler
Older compiler fallback

For libraries that must compile with older Swift versions, keep using conventional tools: @available(..., deprecated, message:), documentation warnings, runtime preconditions in debug builds, and targeted tests. You lose custom diagnostics, but not runtime compatibility.

This is the kind of release work that rarely changes screenshots, but it changes maintenance cost. Better diagnostics make strict concurrency and large package migrations less noisy.

Async Work in defer

Swift 6.4 supports asynchronous code in defer. That lets cleanup remain visually attached to the setup it balances, even when the cleanup itself needs suspension.

Swift 6.4 compiler
Older compiler fallback

If the code still needs to build with Swift 6.3, keep the cleanup explicit. It is noisier, but it works on the same deployment targets as the async APIs you are already calling.

do {
    try await runOperation()
    await cleanup()
} catch {
    await cleanup()
    throw error
}
let landingTask = Task {
    try await lander.fly(to: moon)
}

defer {
    await orbiter.rendezvous(with: lander)
}

try await orbiter.wait(for: landingTask)

Expect this to show up around database transactions, file coordination, network teardown, and actor-owned resources.

Libraries: Testing, Subprocess, Foundation

The standard library and companion packages got quieter but meaningful polish. Swift Testing can be used more naturally from XCTest-based suites, which matters for projects that cannot migrate every test target at once. Subprocess reached a more mature 1.0 shape, including streamed output patterns.

Toolchain/package
OS 26-era fallback

Test code can stay on XCTest until the project adopts the newer Swift Testing interop. For Subprocess, pin the package/toolchain version your CI supports and keep a tiny wrapper at the edge so command execution does not leak through the app.

final class RadioTests: XCTestCase {
    func testPingPacketTransmission() throws {
        let bytes = try checkedTransmitAndReceive(packet: .ping)
        #expect(bytes.count == 8)
    }
}

Foundation also keeps moving toward Swift-native implementations. Apple's Swift page calls out URL parsing gains of up to 4x, which is the kind of improvement server-side and data-heavy apps can feel without code changes.

Performance Without Leaving Swift

The performance story has two levels. First, Swift adds more explicit optimizer controls: @inline(always) for forced inlining and @specialized for important generic paths. Second, ownership features continue to reduce copies without falling back to unsafe pointers.

Swift 6.4 libraries
Older toolchain fallback

If InlineArray or noncopyable iteration is not available in the compiler you still support, keep using Array, measured reserve-capacity paths, or narrow unsafe-buffer code hidden behind a well-tested helper. Do not expose new standard-library types in public APIs until every supported toolchain can compile them.

@inline(always)
func makeBuffer() -> [256 of Int] {
    InlineArray(repeating: 0)
}

@specialized(where Values == [UInt8])
func histogram<Values: Sequence>(of values: Values) -> [256 of Int]
where Values.Element == UInt8 {
    var buckets = makeBuffer()
    for value in values { buckets[Int(value)] += 1 }
    return buckets
}

Do not scatter these attributes everywhere. They are tools for measured hot paths where the compiler cannot see enough context on its own.

Beyond Apple Platforms

Swift's ecosystem work is increasingly visible. The WWDC session called out the first Swift SDK for Android in Swift 6.3, ongoing WebAssembly and JavaScriptKit improvements, Swift-Java work, Windows progress, and continued Embedded Swift investment.

For Apple app teams, the practical takeaway is shared domain code. Swift is no longer only a UI-app language for Apple clients; it is becoming a more credible cross-platform systems and application language.

Adoption Checklist

Replace repeated OS gates with anyAppleOS. Start in shared packages where availability lists are hard to scan.
Use async defer for cleanup paths. It is clearest when setup and teardown need to stay adjacent.
Migrate tests gradually. Keep XCTest where it works, and introduce Swift Testing assertions where they improve readability.
Only tune performance after measuring. @inline(always) and @specialized are precision tools, not style choices.

Sources