File tree 2 files changed +50
-0
lines changed
Sources/ComposableArchitecture/Documentation.docc/Articles
2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ APIs, and these guides contain tips to do so.
14
14
15
15
## Topics
16
16
17
+ - < doc:MigratingTo1.15 >
17
18
- < doc:MigratingTo1.14 >
18
19
- < doc:MigratingTo1.13 >
19
20
- < doc:MigratingTo1.12 >
Original file line number Diff line number Diff line change
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
+ ```
You can’t perform that action at this time.
0 commit comments