General Availability of Swift 6: Announced with expansion to more platforms and domains.
- Beyond App Development: Not just for app development but also great for libraries, internet-scale services, and performance-critical/secure code.
New Low-Level Programming Features:
- Data-Race Safety: New opt-in language mode in Swift 6 to prevent data races in concurrent code. Data-race safety checks previously available as warnings in Swift 5.10.
- Synchronization Library: For low-level concurrency APIs like atomic operations and mutex API.
- Typed Throws: Functions can specify the type of error they throw as part of the signature, useful in generic code and resource-constrained environments.
- Generic Support for Non-Copyable Types: Swift 6 supports non-copyable types with the generics system, enabling generic code to work with both copyable and non-copyable types.
- Switch Statements and Non-Copyable Types: Switch statements can avoid copying within enum pattern-matching operations and are used with non-copyable payloads.
- C++ Interoperability: Expands interoperability support to C++ move-only types, virtual methods, default arguments, and more standard library types.
- Embedded Swift: A language subset and compilation mode for embedded software development with support for ARM and RISC-V bare-metal targets.
- 128-Bit Integer Types: Adds signed and unsigned 128-bit integer types available on all Swift platforms.
Productivity Enhancements:
count(where:)
, pack iteration, access control for imports,@attached(body)
macros, expression macros as default arguments, etc.
Debugging Enhancements:
@DebugDescription
macro to customize object display in LLDB and Xcode/VSCode variables view.- Dramatically improves debugger startup performance with explicit module builds.
Foundation Updates:
- Unifies the implementation of Foundation across all platforms with a modern, portable Swift implementation.
- Core types like
JSONDecoder
,URL
, etc. are reimplemented in Swift. - New Foundation APIs available on all platforms with community involvement.
- Swift Testing: A new testing library with expressive APIs, detailed failure output, and parameterization. Included directly in Swift 6 toolchains.
Platform Support:
- Major improvements to Linux and Windows, including support for more distributions and architectures.
- Fully statically linked executables for Linux.
- Official support and testing for Debian, Fedora, and Ubuntu 24.04.
- Prebuilt toolchains for arm64 architecture on Windows with improved compiler performance and parallel builds.
Learning and Resources:
- The Swift Programming Language book updated.
- Swift.org/getting-started offers tutorials for different use cases.
- Swift package ecosystem with package highlights at Swift.org/packages.
- Encourages community participation in contributing to Swift.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。