Skip to content

Commit 05d62a3

Browse files
committed
feat: sync with swift-book
1 parent a70e116 commit 05d62a3

File tree

472 files changed

+84
-564
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

472 files changed

+84
-564
lines changed

TSPL.docc/GuidedTour/Compatibility.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Concurrency requires the Swift 5 language mode
3333
and a version of the Swift standard library
3434
that provides the corresponding concurrency types.
3535
On Apple platforms, set a deployment target
36-
of at least iOS 13, macOS 10.15, tvOS 13, or watchOS 6.
36+
of at least iOS 13, macOS 10.15, tvOS 13, watchOS 6, or visionOS 1.
3737

3838
A target written in Swift 6 can depend on
3939
a target that's written in Swift 5, Swift 4.2 or Swift 4,

TSPL.docc/LanguageGuide/ControlFlow.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2159,7 +2159,7 @@ the body of the `if` executes on the minimum deployment target specified by your
21592159

21602160
In its general form,
21612161
the availability condition takes a list of platform names and versions.
2162-
You use platform names such as `iOS`, `macOS`, `watchOS`, and `tvOS` ---
2162+
You use platform names such as `iOS`, `macOS`, `watchOS`, `tvOS`, and `visionOS` ---
21632163
for the full list, see <doc:Attributes#Declaration-Attributes>.
21642164
In addition to specifying major version numbers like iOS 8 or macOS 10.10,
21652165
you can specify minor versions numbers like iOS 11.2.6 and macOS 10.13.3.

TSPL.docc/LanguageGuide/ErrorHandling.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ in the following special cases:
745745
and propagates any errors from that closure.
746746
For a comparison between propagating a specific error type
747747
and using `rethrows`,
748-
see <doc:Declarations:Rethrowing-Functions-and-Methods>.
748+
see <doc:Declarations#Rethrowing-Functions-and-Methods>.
749749

750750
For example,
751751
consider code that summarizes ratings

TSPL.docc/LanguageGuide/Macros.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ public macro OptionSet<RawType>() =
274274
```
275275

276276
In the declaration above,
277-
the `@attached(member)` macro includes arguments after the `named:` label
277+
the `@attached(member)` macro includes arguments after the `names:` label
278278
for each of the symbols that the `@OptionSet` macro generates.
279279
The macro adds declarations for symbols named
280280
`RawValue`, `rawValue`, and `init` ---

TSPL.docc/ReferenceManual/Attributes.md

+12-8
Original file line numberDiff line numberDiff line change
@@ -1694,11 +1694,10 @@ The additional result-building methods are as follows:
16941694
or to perform other postprocessing on a result before returning it.
16951695

16961696
- term `static func buildLimitedAvailability(_ component: Component) -> Component`:
1697-
Builds a partial result that propagates or erases type information
1698-
outside a compiler-control statement
1697+
Builds a partial result that erases type information.
1698+
You can implement this method to prevent type information
1699+
from propagating outside a compiler-control statement
16991700
that performs an availability check.
1700-
You can use this to erase type information
1701-
that varies between the conditional branches.
17021701

17031702
For example, the code below defines a simple result builder
17041703
that builds an array of integers.
@@ -1797,9 +1796,14 @@ into code that calls the static methods of the result builder type:
17971796
You can define an overload of `buildExpression(_:)`
17981797
that takes an argument of type `()` to handle assignments specifically.
17991798
- A branch statement that checks an availability condition
1800-
becomes a call to the `buildLimitedAvailability(_:)` method.
1799+
becomes a call to the `buildLimitedAvailability(_:)` method,
1800+
if that method is implemented.
1801+
If you don't implement `buildLimitedAvailability(_:)`,
1802+
then branch statements that check availability
1803+
use the same transformations as other branch statements.
18011804
This transformation happens before the transformation into a call to
18021805
`buildEither(first:)`, `buildEither(second:)`, or `buildOptional(_:)`.
1806+
18031807
You use the `buildLimitedAvailability(_:)` method to erase type information
18041808
that changes depending on which branch is taken.
18051809
For example,
@@ -1874,7 +1878,7 @@ into code that calls the static methods of the result builder type:
18741878

18751879
To solve this problem,
18761880
implement a `buildLimitedAvailability(_:)` method
1877-
to erase type information.
1881+
to erase type information by returning a type that's always available.
18781882
For example, the code below builds an `AnyDrawable` value
18791883
from its availability check.
18801884

@@ -1884,7 +1888,7 @@ into code that calls the static methods of the result builder type:
18841888
func draw() -> String { return content.draw() }
18851889
}
18861890
extension DrawingBuilder {
1887-
static func buildLimitedAvailability(_ content: Drawable) -> AnyDrawable {
1891+
static func buildLimitedAvailability(_ content: some Drawable) -> AnyDrawable {
18881892
return AnyDrawable(content: content)
18891893
}
18901894
}
@@ -2276,7 +2280,7 @@ into code that calls the static methods of the result builder type:
22762280
func draw() -> String { return content.draw() }
22772281
}
22782282
-> extension DrawingBuilder {
2279-
static func buildLimitedAvailability(_ content: Drawable) -> AnyDrawable {
2283+
static func buildLimitedAvailability(_ content: some Drawable) -> AnyDrawable {
22802284
return AnyDrawable(content: content)
22812285
}
22822286
}

TSPL.docc/ReferenceManual/Declarations.md

+15-8
Original file line numberDiff line numberDiff line change
@@ -3940,14 +3940,21 @@ Access control is discussed in detail in <doc:AccessControl>.
39403940
only by code within the declaration's immediate enclosing scope.
39413941

39423942
For the purpose of access control,
3943-
extensions to the same type that are in the same file
3944-
share an access-control scope.
3945-
If the type they extend is also in the same file,
3946-
they share the type's access-control scope.
3947-
Private members declared in the type's declaration
3948-
can be accessed from extensions,
3949-
and private members declared in one extension
3950-
can be accessed from other extensions and from the type's declaration.
3943+
extensions behave as follows:
3944+
3945+
- If there are multiple extensions in the same file,
3946+
and those extensions all extend the same type,
3947+
then all of those extensions have the same access-control scope.
3948+
The extensions and the type they extend can be in different files.
3949+
3950+
- If there are extensions in the same file as the type they extend,
3951+
the extensions have the same access-control scope as the type they extend.
3952+
3953+
- Private members declared in a type's declaration
3954+
can be accessed from extensions to that type.
3955+
Private members declared in one extension
3956+
can be accessed from other extensions
3957+
and from the extended type's declaration.
39513958

39523959
Each access-level modifier above optionally accepts a single argument,
39533960
which consists of the `set` keyword enclosed in parentheses ---

TSPL.docc/ReferenceManual/LexicalStructure.md

+1
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ so they must be escaped with backticks in that context.
260260
`inout`,
261261
`internal`,
262262
`let`,
263+
`nonisolated`,
263264
`open`,
264265
`operator`,
265266
`private`,

TSPL.docc/ReferenceManual/Statements.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,7 @@ see <doc:Expressions#Explicit-Member-Expression>.
12531253
> *platform-condition* **`canImport`** **`(`** *import-path* **`)`** \
12541254
> *platform-condition* **`targetEnvironment`** **`(`** *environment* **`)`**
12551255
>
1256-
> *operating-system* **`macOS`** | **`iOS`** | **`watchOS`** | **`tvOS`** | **`Linux`** | **`Windows`** \
1256+
> *operating-system* **`macOS`** | **`iOS`** | **`watchOS`** | **`tvOS`** | **`visionOS`** | **`Linux`** | **`Windows`** \
12571257
> *architecture* **`i386`** | **`x86_64`** | **`arm`** | **`arm64`** \
12581258
> *swift-version* *decimal-digits* *swift-version-continuation*_?_ \
12591259
> *swift-version-continuation* **`.`** *decimal-digits* *swift-version-continuation*_?_ \
@@ -1341,7 +1341,7 @@ The compiler uses the information from the availability condition
13411341
when it verifies that the APIs in that block of code are available.
13421342

13431343
The availability condition takes a comma-separated list of platform names and versions.
1344-
Use `iOS`, `macOS`, `watchOS`, and `tvOS` for the platform names,
1344+
Use `iOS`, `macOS`, `watchOS`, `tvOS` and `visionOS` for the platform names,
13451345
and include the corresponding version numbers.
13461346
The `*` argument is required and specifies that, on any other platform,
13471347
the body of the code block guarded by the availability condition
@@ -1398,7 +1398,8 @@ It has the same meaning as the `*` argument in an availability condition.
13981398
>> macOS 1, macOSApplicationExtension 1,
13991399
>> macCatalyst 1, macCatalystApplicationExtension 1,
14001400
>> watchOS 1, watchOSApplicationExtension 1,
1401-
>> tvOS 1, tvOSApplicationExtension 1, *) {
1401+
>> tvOS 1, tvOSApplicationExtension 1,
1402+
>> visionOS 1, visionOSApplicationExtension 1, *) {
14021403
>> print("a")
14031404
>> } else {
14041405
>> print("b")

TSPL.docc/ReferenceManual/SummaryOfTheGrammar.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ make the same change here also.
698698
> *platform-condition***`canImport`** **`(`** *import-path* **`)`** \
699699
> *platform-condition***`targetEnvironment`** **`(`** *environment* **`)`**
700700
>
701-
> *operating-system***`macOS`** | **`iOS`** | **`watchOS`** | **`tvOS`** | **`Linux`** | **`Windows`** \
701+
> *operating-system***`macOS`** | **`iOS`** | **`watchOS`** | **`tvOS`** | **`visionOS`** | **`Linux`** | **`Windows`** \
702702
> *architecture***`i386`** | **`x86_64`** | **`arm`** | **`arm64`** \
703703
> *swift-version**decimal-digits* *swift-version-continuation*_?_ \
704704
> *swift-version-continuation***`.`** *decimal-digits* *swift-version-continuation*_?_ \

TSPL.docc/RevisionHistory/RevisionHistory.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
Review the recent changes to this book.
44

5+
**XXX release date XXX**
6+
7+
- Minor corrections throughout.
8+
59
**2024-06-10**
610

711
- Updated for Swift 6.

TSPL.docc/The-Swift-Programming-Language.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# The Swift Programming Language (6.0 beta)
1+
# The Swift Programming Language (6 beta)
22

33
@Metadata {
44
@TechnologyRoot

swift-6-beta-1.docc/.docc-build/css/866.60f074fd.css

-9
This file was deleted.

swift-6-beta-1.docc/.docc-build/css/989.4f123103.css

-9
This file was deleted.

swift-6-beta-1.docc/.docc-build/css/documentation-topic.493b2429.css

-9
This file was deleted.

swift-6-beta-1.docc/.docc-build/css/index.3a335429.css

-9
This file was deleted.

swift-6-beta-1.docc/.docc-build/css/topic.4be8f56d.css

-9
This file was deleted.

swift-6-beta-1.docc/.docc-build/css/tutorials-overview.7942d777.css

-9
This file was deleted.

swift-6-beta-1.docc/.docc-build/data/documentation/the-swift-programming-language.json

-1
This file was deleted.

0 commit comments

Comments
 (0)