Skip to content

Commit a0db558

Browse files
author
zhixuechao
committed
Merge remote-tracking branch 'origin/swift-6-beta-translation' into 1320-languageguide--initializationmd-translate
2 parents fdc8aec + 825dd1d commit a0db558

19 files changed

+1798
-6340
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ We extend our heartfelt thanks to all our contributors. You can find the [list o
173173
| variadic parameters| 可变参数 |
174174
| wrapped | 包装 |
175175
| wrapped value | 被包装值 |
176+
| superclass | 父类 |
177+
| subclass | 子类 |
176178

177179
[published]: https://docs.swift.org/swift-book/documentation/the-swift-programming-language/
178180
[docc]: https://github.com/apple/swift-docc
Lines changed: 18 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,36 @@
1-
<!--
2-
要翻译的文件:https://github.com/SwiftGGTeam/the-swift-programming-language-in-chinese/blob/swift-6-beta-translation/swift-6-beta.docc/GuidedTour/AboutSwift.md
3-
Swift 文档源文件地址:https://docs.swift.org/swift-book/documentation/the-swift-programming-language/aboutswift
4-
翻译估计用时:⭐️
5-
-->
6-
7-
# About Swift
1+
# 关于 Swift
82

9-
Understand the high-level goals of the language.
3+
理解这门语言的高阶目标。
104

11-
Swift is a fantastic way to write software
12-
for phones, tablets, desktops, servers,
13-
or anything else that runs code.
14-
It's a safe and fast programming language
15-
that combines the best in modern language thinking
16-
with wisdom from a diverse open source community.
5+
Swift 是为手机、平板电脑、台式机、服务器或任何其他运行代码的设备编写软件的绝佳方式。它是一种安全且快速的编程语言,结合了现代语言思想的精华,并汲取了来自多元化的开源社区的智慧。
176

18-
Swift is friendly to new programmers,
19-
without sacrificing the power and flexibility
20-
that experienced programmers need.
21-
It's an industrial-quality programming language
22-
that's as expressive and enjoyable as a scripting language.
23-
The compiler is optimized for performance
24-
and the language is optimized for development,
25-
without compromising on either.
7+
Swift 对于初学者来说很友好,同时也没有牺牲经验丰富的程序员所需要的强大和灵活性。它是一种企业级的编程语言,但又有着脚本语言般的表达力和可玩性。编译器经过精心优化,可以提供卓越的性能表现。同时语言本身也经过精心设计,以便于开发使用。两者都没有做出任何妥协,鱼与熊掌兼得。
268

27-
Swift defines away large classes of common programming errors
28-
by adopting modern programming patterns:
9+
Swift 通过采用现代编程模式来避免大量常见编程错误:
2910

30-
- Variables are always initialized before use.
31-
- Array indices are checked for out-of-bounds errors.
32-
- Integers are checked for overflow.
33-
- Optionals ensure that `nil` values are handled explicitly.
34-
- Memory is managed automatically.
35-
- Error handling allows controlled recovery from unexpected failures.
11+
- 变量始终在使用前被初始化。
12+
- 数组索引会进行越界检查。
13+
- 整数运算会进行溢出检查。
14+
- 可选类型确保 `nil` 值能够得到明确处理。
15+
- 内存被自动管理。
16+
- 错误处理机制使程序能够以可控方式从意外异常中恢复。
3617

37-
Swift code is compiled and optimized to get the most out of modern hardware.
38-
The syntax and standard library have been designed
39-
based on the guiding principle that
40-
the obvious way to write your code should also perform the best.
41-
Its combination of safety and speed make Swift an excellent choice for
42-
everything from "Hello, world!" to an entire operating system.
18+
Swift 代码经过编译和优化,以充分发挥现代硬件的性能。其语法和标准库的设计遵循这样的指导思想:代码的最直观写法也应该具有最佳性能。Swift 兼具安全性和速度,使其成为从编写 "Hello, world!" 到开发整个操作系统的绝佳选择。
4319

44-
Swift combines a modern, lightweight syntax
45-
that's familiar for developers coming from other popular languages
46-
with powerful features like type inference and pattern matching,
47-
allowing complex ideas to be expressed in a clear and concise manner.
48-
As a result, code is easier to read, write, and maintain.
20+
Swift 采用了现代化、轻量级的语法,这些语法对来自其他流行语言的开发者来说很熟悉。它还具有类型推断和模式匹配等强大功能,能够以清晰简洁的方式表达复杂的概念。这使得代码更易于阅读、编写和维护。
4921

50-
Swift continues to evolve with thoughtful new features and powerful capabilities.
51-
The goals for Swift are ambitious.
52-
We can’t wait to see what you create with it.
22+
Swift 仍在不断发展,不断推出经过深思熟虑的新特性和强大的功能。Swift 的目标非常远大。我们非常期待看到你使用它创造出的作品。
5323

54-
> Beta Software:
24+
> 测试版软件:
5525
>
56-
> 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.
26+
> 本文档包含有关正在开发的 API 或技术的初步信息。此信息可能会发生变化,根据本文档实施的软件应使用最终操作系统软件进行测试。
5727
>
58-
> Learn more about using [Apple's beta software](https://developer.apple.com/support/beta-software/).
28+
> 了解有关使用 [Apple 测试版软件](https://developer.apple.com/support/beta-software/) 的更多信息.
5929
6030
<!--
6131
This source file is part of the Swift.org open source project
62-
6332
Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors
6433
Licensed under Apache License v2.0 with Runtime Library Exception
65-
6634
See https://swift.org/LICENSE.txt for license information
6735
See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
68-
-->
36+
-->

swift-6-beta.docc/GuidedTour/Compatibility.md

Lines changed: 13 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,26 @@
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+
# 版本兼容性
82

9-
Learn what functionality is available in older language modes.
3+
了解在旧版本中可用的功能。
104

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 编写的代码。
156

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。
228

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 的代码:
2910

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)` 会计算出正确的值,而不是发生溢出。
3714

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 以上。
4316

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 编写的项目,反之亦然。这意味着,如果你有一个大型项目,并将其分为多个框架,你可以逐个框架地将代码迁移到新版本。
5118

52-
> Beta Software:
19+
> Beta 版软件:
5320
>
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 或技术的初步信息。这些信息可能会发生变化,并且根据本文档实现的软件应与最终的操作系统软件一起进行测试。
5522
>
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/) 的信息。
5724
5825
<!--
5926
This source file is part of the Swift.org open source project

0 commit comments

Comments
 (0)