Skip to content

Commit d631d48

Browse files
authored
Added migration guide for 1.15 (#3390)
* Added migration guide for 1.15 * wip
1 parent dcecad3 commit d631d48

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

Sources/ComposableArchitecture/Documentation.docc/Articles/MigrationGuides.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ APIs, and these guides contain tips to do so.
1414
1515
## Topics
1616

17+
- <doc:MigratingTo1.15>
1718
- <doc:MigratingTo1.14>
1819
- <doc:MigratingTo1.13>
1920
- <doc:MigratingTo1.12>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Migrating to 1.15
2+
3+
The library has been completely updated for Swift 6 language mode, and now compiles in strict
4+
concurrency with no warnings or errors.
5+
6+
## Overview
7+
8+
The library is now 100% Swift 6 compatible, and has been done in a way that is full backwards
9+
compatible. If your project does not have strict concurrency warnings turned on, then updating
10+
the Composable Architecture to 1.15.0 should not cause any compilation errors. However, if you have
11+
strict concurrency turned on, then you may come across a few situations you need to update.
12+
13+
### Enum cases as function references
14+
15+
It is common to use the case of enum as a function, such as mapping on an ``Effect`` to bundle
16+
its output into an action:
17+
18+
```swift
19+
return client.fetch()
20+
.map(Action.response)
21+
```
22+
23+
In strict concurrency mode this may fail with a message like this:
24+
25+
> 🛑 Converting non-sendable function value to '@Sendable (Value) -> Action' may introduce data races
26+
27+
There are two ways to fix this. You can either open the closure explicitly instead of using
28+
`Action.response` as a function:
29+
30+
```swift
31+
return client.fetch()
32+
.map { .response($0) }
33+
```
34+
35+
There is also an upcoming Swift feature that will fix this. You can enable it in an SPM package
36+
by adding a `enableUpcomingFeature` to its Swift settings:
37+
38+
```swift
39+
swiftSettings: [
40+
.enableUpcomingFeature("InferSendableFromCaptures"),
41+
]),
42+
```
43+
44+
And you can [enable this feature in Xcode](https://www.swift.org/blog/using-upcoming-feature-flags/)
45+
by navigating to your project's build settings in Xcode, and adding a new "Other Swift Flags" flag:
46+
47+
```
48+
-enable-upcoming-feature InferSendableFromCaptures
49+
```

0 commit comments

Comments
 (0)