Skip to content

Commit b9840e1

Browse files
Guidance document fix #9
1 parent 9624977 commit b9840e1

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

Guide.docc/Guidance.md

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Guidance
2+
3+
Get recommendations on how to proceed with migrating your project to the
4+
Swift 6 language mode.
5+
6+
Enabling complete concurrency checking in a module can yield many data-race
7+
safety issues reported by the compiler.
8+
Hundreds, possibly even thousands of warnings are not uncommon.
9+
When faced with a such a large number of problems,
10+
especially if you are just beginning to learn about Swift's data isolation
11+
model, this can feel insurmountable.
12+
13+
**Don't panic.**
14+
15+
Frequently, you'll find yourself making substantial progress with just a few
16+
changes.
17+
And as you do, your mental model of how the Swift concurrency system works
18+
will develop just as rapidly.
19+
20+
## Strategy
21+
22+
Of course, there is no one single approach that will work for all projects.
23+
But there is a general strategy that is often very effective.
24+
A recommended approach has three key steps:
25+
26+
- Select a module
27+
- Enable complete checking with Swift 5
28+
- Address warnings
29+
30+
This process will be inherently _iterative_.
31+
Even a single change in one module can have a large impact on the state of the
32+
project as a whole.
33+
34+
## Module Selection
35+
36+
It is often easiest to start with the outer-most root module in a project.
37+
This, by definition, is not a depenency of any other module.
38+
Changes here can only have local effects, making it easier to
39+
keep your changes contained.
40+
41+
## Enable Complete Checking
42+
43+
Don't move directly from Swift 5 with no checking to the Swift 6 language mode.
44+
Instead, first begin by [enabling complete checking][] for a
45+
module that currently still using the Swift 5 mode.
46+
This will surface any potential data safety issues as
47+
warnings, allowing you to keep your build and tests functional as you go.
48+
49+
[enabling complete checking]: <doc:CompleteChecking>
50+
51+
## Address Warnings
52+
53+
There is one guiding principle you should use as you being
54+
tacking warnings: **express what true today**.
55+
Resist the urge to refactor your code to address issues.
56+
57+
You will find it beneficial to minimize the amount of change necessary to
58+
get to a warning-free state with complete concurrency checking.
59+
After that is done, use any unsafe opt-outs you applied as an indication of
60+
follow-on refactoring opportunities to introduce a safer isolation mechanism.
61+
62+
> Note: To learn more about addressing common problems, see <doc:CommonProblems>.
63+
64+
## Iteration
65+
66+
At first, you'll likely be employing techniques to disable or workaround
67+
data isolation problems.
68+
Once you feel like you've reached the stopping point for a higher-level module,
69+
target one of its dependencies that has required a workaround.

Guide.docc/MigrationGuide.md

+1
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,4 @@ full code examples, and learn about how to contribute in the [repository][].
6060
- <doc:IncrementalAdoption>
6161
- <doc:CommonProblems>
6262
- <doc:RuntimeBehavior>
63+
- <doc:Guidance>

0 commit comments

Comments
 (0)