You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/concurrency/index.md
+28-5Lines changed: 28 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -8,29 +8,52 @@ Data-race safety in the Swift 6 language mode is designed for incremental migrat
8
8
9
9
Complete data-race safety checking can be enabled as warnings in the Swift 5 language mode using the `-strict-concurrency` compiler flag.
10
10
11
-
## At the command line
11
+
## Using the Swift compiler
12
12
13
13
To enable complete concurrency checking when running `swift` or `swiftc` directly at the command line, pass `-strict-concurrency=complete`:
14
14
15
15
```
16
16
~ swift -strict-concurrency=complete main.swift
17
17
```
18
18
19
-
## In a Swift package manifest
19
+
## Using SwiftPM
20
+
21
+
### In a SwiftPM command-line invocation
22
+
23
+
`-strict-concurrency=complete` can be passed in a Swift package manager command-line invocation using the `-Xswiftc` flag:
24
+
25
+
```
26
+
~ swift build -Xswiftc -strict-concurrency=complete
27
+
~ swift test -Xswiftc -strict-concurrency=complete
28
+
```
29
+
30
+
This can be useful to gauge the amount of concurrency warnings before adding the flag permanently in the package manifest as described in the following section.
31
+
32
+
### In a SwiftPM package manifest
20
33
21
34
To enable complete concurrency checking for a target in a Swift package using Swift 5.9 or Swift 5.10 tools, use [`SwiftSetting.enableExperimentalFeature`](https://developer.apple.com/documentation/packagedescription/swiftsetting/enableexperimentalfeature(_:_:)) in the Swift settings for the given target:
When using Swift 6.0 tools or later, use [`SwiftSetting.enableUpcomingFeature`](https://developer.apple.com/documentation/packagedescription/swiftsetting/enableupcomingfeature(_:_:)) in the Swift settings for the given target:
To enable complete concurrency checking in an Xcode project, set the "Swift Strict Concurrency" setting to "Complete" in the Xcode build settings. Alternatively, you can set `SWIFT_STRICT_CONCURRENCY` to `complete` in an xcconfig file:
0 commit comments