Programming Languages
Swift 6.4 Adds Cleaner Syntax, Better Testing Tools, and Stronger C Integration
Apple's new Swift 6.4 beta simplifies language features, improves test interoperability, and enables Swift-to-C function export.
InfoQ
Swift 6.4, currently in beta through Xcode 27, rolls out a substantial set of language and runtime improvements spanning C interoperability, testing frameworks, and Foundation modernization. The release aims to streamline daily coding workflows while laying groundwork for deeper platform integration.
Language Simplifications#
The update cleans up syntax in several areas. Type expressions no longer require unnecessary parentheses—you can now write any Int? instead of (any Int?)—making generic type annotations less verbose. The compiler has also gained new capabilities around async operations: defer statements now support await, allowing cleanup code to handle asynchronous work. Weak reference handling improves with a new weak let syntax, enabling developers to declare classes as Sendable without resorting to @unchecked Sendable. For types that explicitly should not conform to Sendable, a new ~Sendable annotation provides a clear declaration.
Struct initialization receives a boost through enhanced memberwise generation. When a struct mixes private and internal properties, the compiler now automatically creates two initializers: one for internal members and a private one that includes all fields. Task-based concurrency gets stricter oversight, with the compiler warning developers when thrown errors go unhandled in task closures.
Platform Availability and Diagnostics#
Platform compatibility checks become more concise with the new anyAppleOS identifier. Rather than listing macOS, iOS, visionOS, and other Apple platforms individually, developers can now write a single @available(anyAppleOS 27, *) annotation to check support across the board.
A new @diagnose attribute provides granular control over compiler warnings. Developers can now suppress deprecation warnings, elevate warnings to errors, or downgrade future errors back to warnings on a per-function basis—useful for managing large codebases undergoing migration.
Testing and XCTest Interop#
Swift 6.4 strengthens the bridge between Swift Testing (Apple's modern test framework) and XCTest (the legacy standard). XCTest assertion failures now surface as test issues within Swift Testing, and Swift Testing APIs can run inside XCTest test cases. This cross-framework reporting defaults to warning level but can be promoted to hard failures through Xcode settings.