Skip to content

Commit 947fc48

Browse files
committed
Merge branch 'release/5.8_beta_1'
2 parents 4c41dac + 99fbd56 commit 947fc48

Some content is hidden

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

46 files changed

+4076
-15
lines changed

TSPL.docc/GuidedTour/Compatibility.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
Learn what functionality is available in older language modes.
44

5-
This book describes Swift 5.7,
5+
This book describes Swift 5.8,
66
the default version of Swift that's included in Xcode 14.
77
You can use Xcode 14 to build targets
8-
that are written in either Swift 5.7, Swift 4.2, or Swift 4.
8+
that are written in either Swift 5.8, Swift 4.2, or Swift 4.
99

1010
<!--
1111
- test: `swift-version`
1212
1313
```swifttest
14-
>> #if swift(>=5.7.1)
14+
>> #if swift(>=5.8.1)
1515
>> print("Too new")
16-
>> #elseif swift(>=5.7)
16+
>> #elseif swift(>=5.8)
1717
>> print("Just right")
1818
>> #else
1919
>> print("Too old")
@@ -23,9 +23,9 @@ that are written in either Swift 5.7, Swift 4.2, or Swift 4.
2323
-->
2424

2525
When you use Xcode 14 to build Swift 4 and Swift 4.2 code,
26-
most Swift 5.7 functionality is available.
26+
most Swift 5.8 functionality is available.
2727
That said,
28-
the following changes are available only to code that uses Swift 5.7 or later:
28+
the following changes are available only to code that uses Swift 5.8 or later:
2929

3030
- Functions that return an opaque type require the Swift 5.1 runtime.
3131
- The `try?` expression doesn't introduce an extra level of optionality
@@ -35,18 +35,18 @@ the following changes are available only to code that uses Swift 5.7 or later:
3535
For example, `UInt64(0xffff_ffff_ffff_ffff)` evaluates to the correct value
3636
rather than overflowing.
3737

38-
Concurrency requires Swift 5.7 or later,
38+
Concurrency requires Swift 5.8 or later,
3939
and a version of the Swift standard library
4040
that provides the corresponding concurrency types.
4141
On Apple platforms, set a deployment target
4242
of at least iOS 13, macOS 10.15, tvOS 13, or watchOS 6.
4343

44-
A target written in Swift 5.7 can depend on
44+
A target written in Swift 5.8 can depend on
4545
a target that's written in Swift 4.2 or Swift 4,
4646
and vice versa.
4747
This means, if you have a large project
4848
that's divided into multiple frameworks,
49-
you can migrate your code from Swift 4 to Swift 5.7
49+
you can migrate your code from Swift 4 to Swift 5.8
5050
one framework at a time.
5151

5252
<!--

TSPL.docc/RevisionHistory/RevisionHistory.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
Review the recent changes to this book.
44

5+
**2023-02-16**
6+
7+
- Updated for Swift 5.8.
8+
- Adopted Swift-DocC for publication.
9+
- Minor corrections and additions throughout.
10+
511
**2022-09-12**
612

713
- Updated for Swift 5.7.

TSPL.docc/header-publish.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
<button id="small-menu-toggle"></button>
2222
<nav id="menu">
2323
<ul class="links">
24-
<li><a href="/blog/">Blog</a></li>
25-
<li><a href="/download/">Download</a></li>
26-
<li><a href="/getting-started/">Getting Started</a></li>
27-
<li><a href="/documentation/">Documentation</a></li>
24+
<li><a href="https://www.swift.org/blog/">Blog</a></li>
25+
<li><a href="https://www.swift.org/download/">Download</a></li>
26+
<li><a href="https://www.swift.org/getting-started/">Getting Started</a></li>
27+
<li><a href="https://www.swift.org/documentation/">Documentation</a></li>
2828
</ul>
2929
</nav>
3030
</div>
31-
</header>
31+
</header>

bin/publish-book

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,24 @@ set -eu
2828
# any changes to the content.
2929
export DOCC_JSON_PRETTYPRINT="YES"
3030

31+
output="./swift-book"
32+
33+
# Start at the top level directory of the repository.
34+
cd "$(git rev-parse --show-toplevel)"
35+
3136
# The published version of the book gets the swift.org header.
3237
cp -n TSPL.docc/header-publish.html TSPL.docc/header.html
3338

3439
docc convert \
3540
--experimental-enable-custom-templates \
3641
--hosting-base-path swift-book \
37-
--output-path "./swift-book" \
42+
--output-path "$output" \
3843
TSPL.docc
3944

4045
rm TSPL.docc/header.html
46+
47+
48+
# Copy the redirect pages into every location where the legacy RST-based
49+
# pipeline created an HTML page, to keep links to those chapters and
50+
# sections working.
51+
cp -r bin/redirects/* "$output"
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<html>
2+
<head>
3+
<title>The Swift Programming Language: Redirect</title>
4+
<meta http-equiv="refresh" content="10; url=https://docs.swift.org/swift-book/documentation/the-swift-programming-language/compatibility">
5+
<head>
6+
<body>
7+
<div>
8+
This content has moved; redirecting to the
9+
<a href="https://docs.swift.org/swift-book/documentation/the-swift-programming-language/" id="redirect">new location</a>.
10+
<noscript>
11+
<aside>
12+
This page requires JavaScript.
13+
Please turn on JavaScript and refresh the page.
14+
</aside>
15+
</noscript>
16+
</div>
17+
<script>
18+
const baseURL = "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/";
19+
20+
const headingRedirects = {
21+
"#ID461": "guidedtour#Simple-Values",
22+
"#ID462": "guidedtour#Control-Flow",
23+
"#ID463": "guidedtour#Functions-and-Closures",
24+
}
25+
26+
const chapterRedirects = {
27+
"GuidedTour/GuidedTour.html": "guidedtour",
28+
"GuidedTour/AboutSwift.html": "aboutswift",
29+
"GuidedTour/Compatibility.html": "compatibility",
30+
"GuidedTour/GuidedTour.html": "guidedtour",
31+
"GuidedTour/GuidedTourPart.html": "guidedtour",
32+
33+
"LanguageGuide/AccessControl.html": "accesscontrol",
34+
"LanguageGuide/AdvancedOperators.html": "advancedoperators",
35+
"LanguageGuide/AutomaticReferenceCounting.html": "automaticreferencecounting",
36+
"LanguageGuide/BasicOperators.html": "basicoperators",
37+
"LanguageGuide/ClassesAndStructures.html": "classesandstructures",
38+
"LanguageGuide/Closures.html": "closures",
39+
"LanguageGuide/CollectionTypes.html": "collectiontypes",
40+
"LanguageGuide/Concurrency.html": "concurrency",
41+
"LanguageGuide/ControlFlow.html": "controlflow",
42+
"LanguageGuide/Deinitialization.html": "deinitialization",
43+
"LanguageGuide/Enumerations.html": "enumerations",
44+
"LanguageGuide/ErrorHandling.html": "errorhandling",
45+
"LanguageGuide/Extensions.html": "extensions",
46+
"LanguageGuide/Functions.html": "functions",
47+
"LanguageGuide/Generics.html": "generics",
48+
"LanguageGuide/Inheritance.html": "inheritance",
49+
"LanguageGuide/Initialization.html": "initialization",
50+
"LanguageGuide/LanguageGuidePart.html": "languageguide",
51+
"LanguageGuide/MemorySafety.html": "memorysafety",
52+
"LanguageGuide/Methods.html": "methods",
53+
"LanguageGuide/NestedTypes.html": "nestedtypes",
54+
"LanguageGuide/OpaqueTypes.html": "opaquetypes",
55+
"LanguageGuide/OptionalChaining.html": "optionalchaining",
56+
"LanguageGuide/Properties.html": "properties",
57+
"LanguageGuide/Protocols.html": "protocols",
58+
"LanguageGuide/StringsAndCharacters.html": "stringsandcharacters",
59+
"LanguageGuide/Subscripts.html": "subscripts",
60+
"LanguageGuide/TheBasics.html": "thebasics",
61+
"LanguageGuide/TypeCasting.html": "typecasting",
62+
63+
"ReferenceManual/AboutTheLanguageReference.html": "aboutthelanguagereference",
64+
"ReferenceManual/Attributes.html": "attributes",
65+
"ReferenceManual/Declarations.html": "declarations",
66+
"ReferenceManual/Expressions.html": "expressions",
67+
"ReferenceManual/GenericParametersAndArguments.html": "genericparametersandarguments",
68+
"ReferenceManual/LexicalStructure.html": "lexicalstructure",
69+
"ReferenceManual/Patterns.html": "patterns",
70+
"ReferenceManual/ReferenceManualPart.html": "referencemanual",
71+
"ReferenceManual/Statements.html": "statements",
72+
"ReferenceManual/Types.html": "types",
73+
"ReferenceManual/zzSummaryOfTheGrammar.html": "summaryofthegrammar",
74+
75+
"RevisionHistory/RevisionHistory.html": "revisionhistory",
76+
"RevisionHistory/RevisionHistoryPart.html": "revisionhistory",
77+
}
78+
79+
const path = window.location.pathname;
80+
const hash = window.location.hash;
81+
82+
var newURL = baseURL;
83+
if (hash == "") {
84+
const components = path.split("/");
85+
const part = components[components.length - 2];
86+
const chapter = components[components.length - 1];
87+
const redirectPath = chapterRedirects[part + "/" + chapter];
88+
newURL += redirectPath;
89+
} else {
90+
const redirectPath = headingRedirects[hash];
91+
newURL += redirectPath;
92+
}
93+
94+
document.getElementById("redirect").setAttribute("href", newURL);
95+
window.location = newURL;
96+
</script>
97+
</body>
98+
</html>
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<html>
2+
<head>
3+
<title>The Swift Programming Language: Redirect</title>
4+
<meta http-equiv="refresh" content="10; url=https://docs.swift.org/swift-book/documentation/the-swift-programming-language/guidedtour">
5+
<head>
6+
<body>
7+
<div>
8+
This content has moved; redirecting to the
9+
<a href="https://docs.swift.org/swift-book/documentation/the-swift-programming-language/" id="redirect">new location</a>.
10+
<noscript>
11+
<aside>
12+
This page requires JavaScript.
13+
Please turn on JavaScript and refresh the page.
14+
</aside>
15+
</noscript>
16+
</div>
17+
<script>
18+
const baseURL = "https://docs.swift.org/swift-book/documentation/the-swift-programming-language/";
19+
20+
const headingRedirects = {
21+
"#ID461": "guidedtour#Simple-Values",
22+
"#ID462": "guidedtour#Control-Flow",
23+
"#ID463": "guidedtour#Functions-and-Closures",
24+
}
25+
26+
const chapterRedirects = {
27+
"GuidedTour/GuidedTour.html": "guidedtour",
28+
"GuidedTour/AboutSwift.html": "aboutswift",
29+
"GuidedTour/Compatibility.html": "compatibility",
30+
"GuidedTour/GuidedTour.html": "guidedtour",
31+
"GuidedTour/GuidedTourPart.html": "guidedtour",
32+
33+
"LanguageGuide/AccessControl.html": "accesscontrol",
34+
"LanguageGuide/AdvancedOperators.html": "advancedoperators",
35+
"LanguageGuide/AutomaticReferenceCounting.html": "automaticreferencecounting",
36+
"LanguageGuide/BasicOperators.html": "basicoperators",
37+
"LanguageGuide/ClassesAndStructures.html": "classesandstructures",
38+
"LanguageGuide/Closures.html": "closures",
39+
"LanguageGuide/CollectionTypes.html": "collectiontypes",
40+
"LanguageGuide/Concurrency.html": "concurrency",
41+
"LanguageGuide/ControlFlow.html": "controlflow",
42+
"LanguageGuide/Deinitialization.html": "deinitialization",
43+
"LanguageGuide/Enumerations.html": "enumerations",
44+
"LanguageGuide/ErrorHandling.html": "errorhandling",
45+
"LanguageGuide/Extensions.html": "extensions",
46+
"LanguageGuide/Functions.html": "functions",
47+
"LanguageGuide/Generics.html": "generics",
48+
"LanguageGuide/Inheritance.html": "inheritance",
49+
"LanguageGuide/Initialization.html": "initialization",
50+
"LanguageGuide/LanguageGuidePart.html": "languageguide",
51+
"LanguageGuide/MemorySafety.html": "memorysafety",
52+
"LanguageGuide/Methods.html": "methods",
53+
"LanguageGuide/NestedTypes.html": "nestedtypes",
54+
"LanguageGuide/OpaqueTypes.html": "opaquetypes",
55+
"LanguageGuide/OptionalChaining.html": "optionalchaining",
56+
"LanguageGuide/Properties.html": "properties",
57+
"LanguageGuide/Protocols.html": "protocols",
58+
"LanguageGuide/StringsAndCharacters.html": "stringsandcharacters",
59+
"LanguageGuide/Subscripts.html": "subscripts",
60+
"LanguageGuide/TheBasics.html": "thebasics",
61+
"LanguageGuide/TypeCasting.html": "typecasting",
62+
63+
"ReferenceManual/AboutTheLanguageReference.html": "aboutthelanguagereference",
64+
"ReferenceManual/Attributes.html": "attributes",
65+
"ReferenceManual/Declarations.html": "declarations",
66+
"ReferenceManual/Expressions.html": "expressions",
67+
"ReferenceManual/GenericParametersAndArguments.html": "genericparametersandarguments",
68+
"ReferenceManual/LexicalStructure.html": "lexicalstructure",
69+
"ReferenceManual/Patterns.html": "patterns",
70+
"ReferenceManual/ReferenceManualPart.html": "referencemanual",
71+
"ReferenceManual/Statements.html": "statements",
72+
"ReferenceManual/Types.html": "types",
73+
"ReferenceManual/zzSummaryOfTheGrammar.html": "summaryofthegrammar",
74+
75+
"RevisionHistory/RevisionHistory.html": "revisionhistory",
76+
"RevisionHistory/RevisionHistoryPart.html": "revisionhistory",
77+
}
78+
79+
const path = window.location.pathname;
80+
const hash = window.location.hash;
81+
82+
var newURL = baseURL;
83+
if (hash == "") {
84+
const components = path.split("/");
85+
const part = components[components.length - 2];
86+
const chapter = components[components.length - 1];
87+
const redirectPath = chapterRedirects[part + "/" + chapter];
88+
newURL += redirectPath;
89+
} else {
90+
const redirectPath = headingRedirects[hash];
91+
newURL += redirectPath;
92+
}
93+
94+
document.getElementById("redirect").setAttribute("href", newURL);
95+
window.location = newURL;
96+
</script>
97+
</body>
98+
</html>

0 commit comments

Comments
 (0)