|
1 |
| -<!-- |
2 |
| -要翻译的文件:https://github.com/SwiftGGTeam/the-swift-programming-language-in-chinese/blob/swift-6-beta-translation/swift-6-beta.docc/GuidedTour/Compatibility.md |
3 |
| -Swift 文档源文件地址:https://docs.swift.org/swift-book/documentation/the-swift-programming-language/compatibility |
4 |
| -翻译估计用时:⭐️ |
5 |
| ---> |
6 |
| - |
7 |
| -# Version Compatibility |
| 1 | +# 版本兼容性 |
8 | 2 |
|
9 |
| -Learn what functionality is available in older language modes. |
| 3 | +了解在旧版本中可用的功能。 |
10 | 4 |
|
11 |
| -This book describes Swift 6, |
12 |
| -the default version of Swift that's included in Xcode 16. |
13 |
| -You can use the Swift 6 compiler to build code |
14 |
| -that's written in Swift 6, Swift 5, Swift 4.2, or Swift 4. |
| 5 | +本书介绍了 Swift 6,这是 Xcode 16 中包含的默认 Swift 版本。你可以使用 Swift 6 编译器来构建 Swift 6、Swift 5、Swift 4.2 或 Swift 4 编写的代码。 |
15 | 6 |
|
16 |
| -When you use the Swift 6 compiler |
17 |
| -to build code that uses the Swift 5 language mode, |
18 |
| -you can use the new features from Swift 6 --- |
19 |
| -they're enabled either by default or by an upcoming feature flag. |
20 |
| -However, to enable strict concurrency checking, |
21 |
| -you need to upgrade to the Swift 6 language mode. |
| 7 | +当你使用 Swift 6 编译器构建 Swift 5 的代码时,你可以使用 Swift 6 的新功能 —— 这些功能要么默认启用,要么通过即将推出的功能标志启用。然而,要启用严格的并发检查,你需要升级到 Swift 6。 |
22 | 8 |
|
23 |
| -In addition, |
24 |
| -when you use Xcode 15.3 to build Swift 4 and Swift 4.2 code, |
25 |
| -most Swift 5 functionality is still available. |
26 |
| -That said, |
27 |
| -the following changes are available only to code |
28 |
| -that uses the Swift 5 language mode: |
| 9 | +此外,当你使用 Xcode 15.3 构建 Swift 4 和 Swift 4.2 的代码时,大部分 Swift 5 的功能仍然可用。不过,以下更改仅适用于使用 Swift 5 的代码: |
29 | 10 |
|
30 |
| -- Functions that return an opaque type require the Swift 5.1 runtime. |
31 |
| -- The `try?` expression doesn't introduce an extra level of optionality |
32 |
| - to expressions that already return optionals. |
33 |
| -- Large integer literal initialization expressions are inferred |
34 |
| - to be of the correct integer type. |
35 |
| - For example, `UInt64(0xffff_ffff_ffff_ffff)` evaluates to the correct value |
36 |
| - rather than overflowing. |
| 11 | +- 返回不透明类型的函数需要 Swift 5.1 的运行时支持。 |
| 12 | +- `try?` 表达式不会为已经返回可选值的表达式引入额外的可选性的层级。 |
| 13 | +- 大型整数字面量初始化表达式会被推断为正确的整数类型。例如,`UInt64(0xffff_ffff_ffff_ffff)` 会计算出正确的值,而不是发生溢出。 |
37 | 14 |
|
38 |
| -Concurrency requires the Swift 5 language mode |
39 |
| -and a version of the Swift standard library |
40 |
| -that provides the corresponding concurrency types. |
41 |
| -On Apple platforms, set a deployment target |
42 |
| -of at least iOS 13, macOS 10.15, tvOS 13, watchOS 6, or visionOS 1. |
| 15 | +并发功能需要 Swift 5 版本以及提供相应并发类型的 Swift 标准库版本。在 Apple 平台上,部署的目标版本需设置为 iOS 13、macOS 10.15、tvOS 13、watchOS 6 或 visionOS 1 以上。 |
43 | 16 |
|
44 |
| -A target written in Swift 6 can depend on |
45 |
| -a target that's written in Swift 5, Swift 4.2 or Swift 4, |
46 |
| -and vice versa. |
47 |
| -This means, if you have a large project |
48 |
| -that's divided into multiple frameworks, |
49 |
| -you can migrate your code to a newer language version |
50 |
| -one framework at a time. |
| 17 | +用 Swift 6 编写的项目可以依赖 Swift 5、Swift 4.2 或 Swift 4 编写的项目,反之亦然。这意味着,如果你有一个大型项目,并将其分为多个框架,你可以逐个框架地将代码迁移到新版本。 |
51 | 18 |
|
52 |
| -> Beta Software: |
| 19 | +> Beta 版软件: |
53 | 20 | >
|
54 |
| -> This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software. |
| 21 | +> 本文档包含关于正在开发的 API 或技术的初步信息。这些信息可能会发生变化,并且根据本文档实现的软件应与最终的操作系统软件一起进行测试。 |
55 | 22 | >
|
56 |
| -> Learn more about using [Apple's beta software](https://developer.apple.com/support/beta-software/). |
| 23 | +> 点击了解更多关于使用 [Apple Beta 版本软件]的信息(https://developer.apple.com/support/beta-software/) 的信息。 |
57 | 24 |
|
58 | 25 | <!--
|
59 | 26 | This source file is part of the Swift.org open source project
|
|
0 commit comments