DEV Community

Cover image for WWDC 2026 - What's New in Swift
ArshTechPro
ArshTechPro

Posted on

WWDC 2026 - What's New in Swift

Swift 6.3 and 6.4 landed at WWDC 2026 with a strong theme running through them: less boilerplate, fewer surprises, and more control. The session covers four broad areas — language improvements, library updates, cross-platform support, and performance. This article also folds in what shipped in Swift 6.3 earlier this year that the session touched on but did not fully detail.

Language

  • Better Swift Concurrency diagnostics
  • Improved Sendable conformances — weak let support, ~Sendable opt-out
  • More accessible memberwise initializers
  • anyAppleOS availability shorthand
  • @diagnose for per-declaration warning control
  • Module selectors (:: syntax) for disambiguating name conflicts
  • @c attribute for exposing Swift functions to C code

Library

  • withTaskCancellationShield for protecting critical work from cancellation
  • Safe Continuation<Success, Failure> type with compile-time misuse detection
  • Ref<T> and MutableRef<T> — safe first-class references without unsafe pointers
  • Dictionary.mapKeyedValues
  • New FilePath type in Foundation
  • Swift Testing: issue severity, test cancellation, image attachments, and XCTest interoperability
  • Subprocess output streaming
  • ProgressManager for structured async progress reporting
  • DocC: Markdown output, static HTML content, code block annotations

Performance

  • @inline(never) / @inline(always) for explicit inlining control
  • @specialized for pre-compiled generic specializations
  • @export(implementation) for ABI-stable library optimization
  • ~Copyable and ~Escapable in protocol associated types
  • borrow and mutate accessors for non-copyable types
  • MutableRef for hoisting repeated subscript accesses

Cross-Platform

  • Official Swift SDK for Android
  • Embedded Swift improvements
  • Swift Build preview in Swift Package Manager

Language Improvements

Better Swift Concurrency Diagnostics

The compiler now catches more concurrency mistakes and gives you clearer guidance when it does. Two patterns that previously slipped through are now properly diagnosed: catching errors inside a Task block, and saving a task reference for later rendezvous.

// Catching inside a Task
Task {
    do {
        try lander.fly(to: moon)
    } catch {
        lander.abort()
    }
}

// Saving a Task for later
let landingTask = Task {
    try lander.fly(to: moon)
}

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

try await orbiter.justHangOut(waitingFor: landingTask)
Enter fullscreen mode Exit fullscreen mode

Improved Sendable Conformances

Working with Sendable in class hierarchies just got more expressive. You can now mark a class as ~Sendable to opt out, and weak let properties are supported in Sendable types.

final class Spacecraft: Sendable {
    weak let dockedAt: SpaceStation?  // weak let now works in Sendable types
}

class Mission: ~Sendable { ... }

class CrewedMission: Mission, @unchecked Sendable { ... }
Enter fullscreen mode Exit fullscreen mode

More Accessible Memberwise Initializers

Swift now generates multiple memberwise initializers at different access levels based on property visibility. If a struct has a mix of internal and private properties, you get both an internal initializer (without the private properties) and a private one (with everything). No more hand-writing boilerplate initializers just to work around access control.

struct Briefing {
    internal var topic: String
    internal var scheduledAt: Date
    private  var attendees: [Person] = []
}

// Swift generates both:
// internal init(topic:scheduledAt:)
// private  init(topic:scheduledAt:attendees:)
Enter fullscreen mode Exit fullscreen mode

anyAppleOS Availability

Tired of spelling out every Apple platform in availability annotations? Swift 6.4 introduces anyAppleOS as a shorthand that covers iOS, macOS, watchOS, tvOS, and visionOS in one shot. Works in both @available attributes and #if conditions.

// Before
@available(macOS 27, iOS 27, watchOS 27, tvOS 27, visionOS 27, *)
func showStatus() { ... }

// After
@available(anyAppleOS 27, *)
func showStatus() { ... }

#if os(anyAppleOS)
func makeLiveActivityWidget() -> some Widget { ... }
#endif
Enter fullscreen mode Exit fullscreen mode

You can still layer platform-specific exclusions on top:

@available(anyAppleOS 27, *)
@available(tvOS, unavailable)
func launch() { ... }
Enter fullscreen mode Exit fullscreen mode

@diagnose — Fine-Grained Warning Control

The new @diagnose attribute lets you control how the compiler treats specific diagnostics on a per-declaration basis. You can silence a deprecation warning, promote a warning to an error, or demote a future error to a warning — all scoped to a single function.

// Silence a deprecation warning with a reason
@diagnose(DeprecatedDeclaration, as: ignored, reason: "Flying with surplus hardware")
func makeApolloSoyuzMission() -> Mission { ... }

// Treat strict memory safety as a warning instead of the default
@diagnose(StrictMemorySafety, as: warning)
func uplinkCommand(from receiver: inout Receiver, to computer: inout Computer) { ... }

// Treat a future Swift error as an error now, ahead of the version bump
@diagnose(ErrorInFutureSwiftVersion, as: error)
func fetchPosition() -> (x: Double, y: Double, z: Double) { ... }
Enter fullscreen mode Exit fullscreen mode

Module Selectors (:: Syntax)

When two imported modules export the same name, Swift 6.3 gives you a clean way to be explicit: the double-colon module selector. It works on both types and members.

import Rocket
import GiftShopToys

let rocket2 = Rocket.SaturnV()   // ambiguous — prefers Rocket module's Rocket.SaturnV
let rocket3 = Rocket::SaturnV()  // unambiguous — definitely Rocket module's SaturnV
Enter fullscreen mode Exit fullscreen mode

It also resolves method name conflicts from protocol extensions:

// Calls the HumanResources version of fire(), not Chemistry's
launchPadTechnician.HumanResources::fire()
Enter fullscreen mode Exit fullscreen mode

Module selectors also work with the Swift module itself, which is useful when a local name shadows a standard library type:

let task = Swift::Task {
    // async work
}
Enter fullscreen mode Exit fullscreen mode

@c Attribute for C Interoperability

Swift 6.3 introduces the @c attribute, which lets you expose Swift functions and enums to C code. Annotating a function with @c causes Swift to include a matching declaration in the generated C header — no manual bridging header edits required.

@c
func callFromC() { ... }

// Generated C header:
// void callFromC(void);
Enter fullscreen mode Exit fullscreen mode

You can provide a custom name for the generated C declaration:

@c(MyLibrary_callFromC)
func callFromC() { ... }

// Generated C header:
// void MyLibrary_callFromC(void);
Enter fullscreen mode Exit fullscreen mode

@c also pairs with @implementation, letting you write a Swift implementation for a function that is already declared in a C header. Swift validates that the signatures match rather than generating a new declaration.

// C header
void callFromC(void);

// Swift implementation
@c @implementation
func callFromC() { ... }
Enter fullscreen mode Exit fullscreen mode

Library Updates

withTaskCancellationShield

Sometimes a piece of work must complete even if the parent task is cancelled — like sending an emergency signal. The new withTaskCancellationShield wrapper protects a block of code from task cancellation, letting it run to completion regardless.

extension EmergencyTransponder {
    func sendSOS() {
        withTaskCancellationShield {
            radio.send(makeSOSPacket())
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

Safe Continuations with Continuation

Bridging callback-based APIs to Swift concurrency has always required a tradeoff: UnsafeContinuation is fast but silent on misuse, while CheckedContinuation catches mistakes at the cost of extra allocations. Swift 6.3 adds a third option, Continuation<Success, Failure>, that makes double-resume a compile-time error and a missing resume a runtime trap — with no overhead on the fast path.

let value = try await withContinuation { continuation in
    someCallbackAPI { result in
        continuation.resume(returning: result)
    }
}
Enter fullscreen mode Exit fullscreen mode

Ref<T> and MutableRef<T>

Storing a reference to part of a data structure previously required either a class (heap allocation, reference counting) or UnsafePointer (all the unsafe caveats). Swift 6.3 adds Ref<T> and MutableRef<T> to the standard library: safe types that hold shared and exclusive references to a value respectively, usable as local variables, struct members, and generic type parameters.

Dictionary.mapKeyedValues

A small but welcome addition. When you need to transform dictionary values while keeping access to the key, you previously had to construct the result manually. Now there is a purpose-built method for it.

// Before
let new: [Mission: String] = .init(
    uniqueKeysWithValues: missions.lazy.map { mission, launchWindow in
        (mission, makeDisplayName(for: mission, in: launchWindow))
    }
)

// After
missions.mapKeyedValues { mission, launchWindow in
    makeDisplayName(for: mission, in: launchWindow)
}
Enter fullscreen mode Exit fullscreen mode

New FilePath Type

Foundation gains a new FilePath type that correctly handles macOS resource forks and named resources (the ..namedresource/rsrc path suffix). When iterating path components, it strips these platform-specific suffixes automatically.

var path: FilePath = "/var/www/static/..namedresource/rsrc"
print(path.components)
// [ "var", "www", "static" ]
Enter fullscreen mode Exit fullscreen mode

Swift Testing: Issue Severity, Test Cancellation, and Image Attachments

Swift Testing picks up three improvements. First, you can record an issue with a .warning severity — useful for soft failures that do not warrant stopping the test.

Issue.record(
    "\(rocket.name) remaining fuel is below 10% reserve target",
    severity: .warning
)
Enter fullscreen mode Exit fullscreen mode

Second, Test.cancel lets a test stop itself early with a message, which is cleaner than a conditional return and more expressive than skipping.

if rocket.engineType == .solid {
    try Test.cancel("\(rocket.name) has solid fuel")
}
Enter fullscreen mode Exit fullscreen mode

Third, you can now attach images to test results on Apple and Windows platforms via new cross-import overlay modules with UIKit and other UI frameworks. Useful for snapshot-style tests where seeing what was rendered matters as much as whether the assertion passed.

XCTest Interoperability

You can now freely mix XCTest assertions and Swift Testing expectations in the same codebase — calling XCTAssertEqual from a Swift Testing test, or using #expect inside an XCTestCase. Migration from XCTest no longer has to be all-or-nothing.

Subprocess Output Streaming

Subprocess now supports streaming output via .sequence, so you can process command output lazily as it arrives instead of waiting for the process to finish.

let result = try await Subprocess.run(.name("ls"),
                                      input: .none,
                                      output: .sequence,
                                      error: .string(limit: 4096)) { execution in
    execution.standardOutput.strings().filter { $0.hasSuffix(".obj") }
}

for try await objectFiles in result.closureOutput {
    print("Object file: \(objectFiles)")
}
Enter fullscreen mode Exit fullscreen mode

Progress Reporting

A new ProgressManager API brings structured progress reporting with Swift concurrency support. Progress can be composed hierarchically using subprogress objects, and updates can be observed with Observations.

let manager = ProgressManager(totalCount: 100)
try await rocket.launch(mission.subprogress(assigningCount: 100))

Task {
    for await update in Observations({ mission.fractionCompleted }) {
        print("Mission \(Int(update * 100))%")
    }
}
Enter fullscreen mode Exit fullscreen mode

DocC Improvements

Swift 6.3 adds three experimental capabilities to DocC worth knowing about if you maintain a library:

Markdown output. Generate Markdown versions of documentation pages alongside the standard rendered JSON using --enable-experimental-markdown-output.

Static HTML content per page. Embed a lightweight HTML summary of each page — title, description, availability, declarations — directly in index.html inside a <noscript> tag. Improves search engine discoverability and screen reader accessibility without requiring JavaScript. Pass --transform-for-static-hosting --experimental-transform-for-static-hosting-with-content to enable it.

Code block annotations. New formatting options for fenced code blocks: nocopy disables the copy-to-clipboard button, highlight highlights specific line numbers, showLineNumbers shows line numbers, and wrap wraps long lines at a column width.

```swift, highlight=[1, 3]
let name = "World"              // highlighted
let greeting = "Hello"
print("\(greeting), \(name)!")  // highlighted
```
Enter fullscreen mode Exit fullscreen mode

Enable with --enable-experimental-code-block-annotations.


Performance

Inlining Control: @inline(never) and @inline(always)

Swift now exposes explicit inlining attributes for when the optimizer needs a nudge. @inline(never) prevents a function from being inlined — useful for controlling code size or isolating a function during profiling. @inline(always) forces inlining where the performance gain is known and worth the code size cost.

@inline(never)
func makeInts(randomized: Bool) -> [256 of Int] { ... }

@inline(always)
func makeInts(randomized: Bool) -> [256 of Int] { ... }
Enter fullscreen mode Exit fullscreen mode

@specialized for Generic Functions

Generic functions generate a single implementation that works for all types. When a specific concrete type is used frequently, @specialized tells the compiler to emit a dedicated, fully optimized version for that type — getting the performance of a non-generic function without giving up the generic API.

@specialized(where Values == [UInt8])
func histogram<Values>(of values: Values) -> [256 of Int] where Values: Sequence<UInt8> {
    // Compiler emits a specialized version for [UInt8]
}
Enter fullscreen mode Exit fullscreen mode

@export(implementation) for ABI-Stable Libraries

Library authors building ABI-stable frameworks can now use @export(implementation) to expose a function's implementation to clients, allowing it to participate in more compiler optimizations across module boundaries — without breaking ABI.

~Copyable and ~Escapable in Protocol Associated Types

Protocols can now express that their associated types do not need to be copyable or escapable, enabling more expressive and efficient protocol designs — particularly for iterator and span-based APIs that need to avoid unnecessary copies.

borrow and mutate Accessors

A new pair of accessors replaces the old get/set pattern for types that wrap unsafe pointers. borrow provides a read-only reference without copying; mutate provides a mutable reference. Together they allow non-copyable types to expose stored properties cleanly and safely.

public var value: Value {
    borrow { valuePointer.pointee }
    mutate { &valuePointer.pointee }
}
Enter fullscreen mode Exit fullscreen mode

MutableRef for Hoisted Accesses

Subscript accesses inside loops — like updating a dictionary value — can result in repeated redundant lookups. MutableRef lets you hoist that access out of the loop manually, holding a stable mutable reference to the element for the duration of the operation.

var countRef = MutableRef(&counts[key, default: 0])

for set in sets {
    if set.contains(key) {
        countRef.value += 1
    }
}
Enter fullscreen mode Exit fullscreen mode

Cross-Platform

Official Swift SDK for Android

Swift 6.3 ships the first official Swift SDK for Android. You can now build native Android programs in Swift, add Android as a target in your Swift packages, and integrate Swift code into existing Kotlin/Java Android apps using Swift Java and Swift Java JNI Core. This is a meaningful milestone — the Android target has existed as a grassroots community effort for years and is now a first-class, officially supported platform.

To get started: Getting Started with the Swift SDK for Android.

Embedded Swift

Embedded Swift continues to mature in Swift 6.3, with enhanced C interoperability, better debugging support, and meaningful progress toward a complete linkage model. If you are targeting microcontrollers or bare-metal environments, the Embedded Swift improvements post covers the details.

Swift Build Preview in Swift Package Manager

Swift 6.3 integrates a preview of Swift Build — a unified build engine across all supported platforms — into Swift Package Manager. The goal is a more consistent cross-platform build experience. Try it in your packages and report issues; it is opt-in for now.

SPM also gains swift package show-traits to discover the traits a package supports, and better support for prebuilt Swift Syntax binaries in shared macro libraries.


Summary

Swift 6.3 and 6.4 together tell a clear story: the language is maturing and the team knows it. The ergonomics work — anyAppleOS, improved memberwise initializers, better concurrency diagnostics — removes friction that has been accumulating for years. The cross-platform push, with an official Android SDK and continued Embedded Swift investment, reflects a genuine commitment to Swift outside the Apple ecosystem.

Top comments (1)

Collapse
 
arshtechpro profile image
ArshTechPro

Better Swift Concurrency diagnostics
Improved Sendable conformances — weak let support, ~Sendable opt-out
More accessible memberwise initializers
anyAppleOS availability shorthand
@diagnose for per-declaration warning control
Module selectors (:: syntax) for disambiguating name conflicts
@c attribute for exposing Swift functions to C code