Skip to content

Commit 990bff9

Browse files
Merge branch 'pointfreeco:main' into dynamic2
2 parents e5374a1 + cbf8a45 commit 990bff9

File tree

16 files changed

+521
-396
lines changed

16 files changed

+521
-396
lines changed

Examples/CaseStudies/SwiftUICaseStudies/01-GettingStarted-FocusState.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ struct FocusDemoView: View {
5757
VStack {
5858
TextField("Username", text: viewStore.binding(\.$username))
5959
.focused($focusedField, equals: .username)
60-
6160
SecureField("Password", text: viewStore.binding(\.$password))
6261
.focused($focusedField, equals: .password)
6362
Button("Sign In") {

Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,12 +474,14 @@ That is the basics of building and testing a feature in the Composable Architect
474474
The documentation for releases and `main` are available here:
475475

476476
* [`main`](https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture)
477-
* [0.46.0](https://pointfreeco.github.io/swift-composable-architecture/0.46.0/documentation/composablearchitecture/)
477+
* [0.47.0](https://pointfreeco.github.io/swift-composable-architecture/0.47.0/documentation/composablearchitecture/)
478+
478479
<details>
479480
<summary>
480481
Other versions
481482
</summary>
482483

484+
* [0.46.0](https://pointfreeco.github.io/swift-composable-architecture/0.46.0/documentation/composablearchitecture/)
483485
* [0.45.0](https://pointfreeco.github.io/swift-composable-architecture/0.45.0/documentation/composablearchitecture/)
484486
* [0.44.0](https://pointfreeco.github.io/swift-composable-architecture/0.44.0/documentation/composablearchitecture/)
485487
* [0.43.0](https://pointfreeco.github.io/swift-composable-architecture/0.43.0/documentation/composablearchitecture/)

Sources/ComposableArchitecture/Documentation.docc/ComposableArchitecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ day-to-day when building applications, such as:
6060
### State management
6161

6262
- ``ReducerProtocol``
63-
- ``EffectPublisher``
63+
- ``EffectTask``
6464
- ``Store``
6565
- ``ViewStore``
6666

Sources/ComposableArchitecture/Documentation.docc/Extensions/Deprecations/SwiftUIDeprecations.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,5 @@ Avoid using deprecated APIs in your app. Select a method to see the replacement
3333
- ``WithViewStore/Action``
3434
- ``WithViewStore/State``
3535

36-
### View state
37-
38-
- ``ActionSheetState``
39-
4036
<!--DocC: Can't currently document `View` extensions-->
4137
<!--### View Modifiers-->

Sources/ComposableArchitecture/Documentation.docc/Extensions/Effect.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
# ``ComposableArchitecture/EffectPublisher``
1+
# ``ComposableArchitecture/EffectTask``
22

33
## Topics
44

55
### Creating an effect
66

7-
- ``none``
8-
- ``task(priority:operation:catch:file:fileID:line:)``
9-
- ``run(priority:operation:catch:file:fileID:line:)``
10-
- ``fireAndForget(priority:_:)``
7+
- ``EffectPublisher/none``
8+
- ``EffectPublisher/task(priority:operation:catch:file:fileID:line:)``
9+
- ``EffectPublisher/run(priority:operation:catch:file:fileID:line:)``
10+
- ``EffectPublisher/fireAndForget(priority:_:)``
1111
- ``TaskResult``
1212

1313
### Cancellation
1414

15-
- ``cancellable(id:cancelInFlight:)-29q60``
16-
- ``cancel(id:)-6hzsl``
17-
- ``cancel(ids:)-1cqqx``
15+
- ``EffectPublisher/cancellable(id:cancelInFlight:)-29q60``
16+
- ``EffectPublisher/cancel(id:)-6hzsl``
17+
- ``EffectPublisher/cancel(ids:)-1cqqx``
1818
- ``withTaskCancellation(id:cancelInFlight:operation:)-4dtr6``
1919

2020
### Composition
2121

22-
- ``map(_:)-yn70``
23-
- ``merge(_:)-45guh``
24-
- ``merge(_:)-3d54p``
22+
- ``EffectPublisher/map(_:)-yn70``
23+
- ``EffectPublisher/merge(_:)-45guh``
24+
- ``EffectPublisher/merge(_:)-3d54p``
2525

2626
### Concurrency
2727

2828
- ``UncheckedSendable``
2929

3030
### Testing
3131

32-
- ``unimplemented(_:)``
32+
- ``EffectPublisher/unimplemented(_:)``
3333

3434
### SwiftUI integration
3535

36-
- ``animation(_:)``
36+
- ``EffectPublisher/animation(_:)``
3737

3838
### Deprecations
3939

Sources/ComposableArchitecture/Documentation.docc/Extensions/TestStore.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
### Creating a test store
66

7-
- ``init(initialState:reducer:file:line:)``
7+
- ``init(initialState:reducer:prepareDependencies:file:line:)``
88

99
### Configuring a test store
1010

@@ -18,7 +18,7 @@
1818
- ``receive(_:timeout:assert:file:line:)-1rwdd``
1919
- ``receive(_:timeout:assert:file:line:)-4e4m0``
2020
- ``receive(_:timeout:assert:file:line:)-3myco``
21-
- ``finish(timeout:file:line:)``
21+
- ``finish(timeout:file:line:)-53gi5``
2222
- ``TestStoreTask``
2323

2424
### Methods for skipping actions and effects

Sources/ComposableArchitecture/Effect.swift

Lines changed: 85 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,55 @@ import Foundation
33
import SwiftUI
44
import XCTestDynamicOverlay
55

6-
/// A type that encapsulates a unit of work that can be run in the outside world, and can feed
7-
/// actions back to the ``Store``.
8-
///
9-
/// Effects are the perfect place to do side effects, such as network requests, saving/loading
10-
/// from disk, creating timers, interacting with dependencies, and more. They are returned from
11-
/// reducers so that the ``Store`` can perform the effects after the reducer is done running.
12-
///
13-
/// There are 2 distinct ways to create an `Effect`: one using Swift's native concurrency tools, and
14-
/// the other using Apple's Combine framework:
15-
///
16-
/// * If using Swift's native structured concurrency tools then there are 3 main ways to create an
17-
/// effect, depending on if you want to emit one single action back into the system, or any number
18-
/// of actions, or just execute some work without emitting any actions:
19-
/// * ``EffectPublisher/task(priority:operation:catch:file:fileID:line:)``
20-
/// * ``EffectPublisher/run(priority:operation:catch:file:fileID:line:)``
21-
/// * ``EffectPublisher/fireAndForget(priority:_:)``
22-
/// * If using Combine in your application, in particular for the dependencies of your feature
23-
/// then you can create effects by making use of any of Combine's operators, and then erasing the
24-
/// publisher type to ``EffectPublisher`` with either `eraseToEffect` or `catchToEffect`. Note that
25-
/// the Combine interface to ``EffectPublisher`` is considered soft deprecated, and you should
26-
/// eventually port to Swift's native concurrency tools.
27-
///
28-
/// > Important: ``Store`` is not thread safe, and so all effects must receive values on the same
29-
/// thread. This is typically the main thread, **and** if the store is being used to drive UI then
30-
/// it must receive values on the main thread.
31-
/// >
32-
/// > This is only an issue if using the Combine interface of ``EffectPublisher`` as mentioned
33-
/// above. If you are using Swift's concurrency tools and the `.task`, `.run` and `.fireAndForget`
34-
/// functions on ``EffectTask``, then threading is automatically handled for you.
6+
/// This type is deprecated in favor of ``EffectTask``. See its documentation for more information.
7+
@available(
8+
iOS,
9+
deprecated: 9999.0,
10+
message:
11+
"""
12+
'EffectPublisher' has been deprecated in favor of 'EffectTask'.
13+
14+
You are encouraged to use `EffectTask<Action>` to model the ouput of your reducers, and to use Swift concurrency to model asynchrony in dependencies.
15+
16+
See the migration roadmap for more information: https://github.com/pointfreeco/swift-composable-architecture/discussions/1477
17+
"""
18+
)
19+
@available(
20+
macOS,
21+
deprecated: 9999.0,
22+
message:
23+
"""
24+
'EffectPublisher' has been deprecated in favor of 'EffectTask'.
25+
26+
You are encouraged to use `EffectTask<Action>` to model the ouput of your reducers, and to use Swift concurrency to model asynchrony in dependencies.
27+
28+
See the migration roadmap for more information: https://github.com/pointfreeco/swift-composable-architecture/discussions/1477
29+
"""
30+
)
31+
@available(
32+
tvOS,
33+
deprecated: 9999.0,
34+
message:
35+
"""
36+
'EffectPublisher' has been deprecated in favor of 'EffectTask'.
37+
38+
You are encouraged to use `EffectTask<Action>` to model the ouput of your reducers, and to use Swift concurrency to model asynchrony in dependencies.
39+
40+
See the migration roadmap for more information: https://github.com/pointfreeco/swift-composable-architecture/discussions/1477
41+
"""
42+
)
43+
@available(
44+
watchOS,
45+
deprecated: 9999.0,
46+
message:
47+
"""
48+
'EffectPublisher' has been deprecated in favor of 'EffectTask'.
49+
50+
You are encouraged to use `EffectTask<Action>` to model the ouput of your reducers, and to use Swift concurrency to model asynchrony in dependencies.
51+
52+
See the migration roadmap for more information: https://github.com/pointfreeco/swift-composable-architecture/discussions/1477
53+
"""
54+
)
3555
public struct EffectPublisher<Action, Failure: Error> {
3656
@usableFromInline
3757
enum Operation {
@@ -60,20 +80,38 @@ extension EffectPublisher {
6080
}
6181
}
6282

63-
/// A convenience type alias for referring to an effect that can never fail, like the kind of
64-
/// ``EffectPublisher`` returned by a reducer after processing an action.
83+
/// A type that encapsulates a unit of work that can be run in the outside world, and can feed
84+
/// actions back to the ``Store``.
6585
///
66-
/// Instead of specifying `Never` as `Failure`:
86+
/// Effects are the perfect place to do side effects, such as network requests, saving/loading
87+
/// from disk, creating timers, interacting with dependencies, and more. They are returned from
88+
/// reducers so that the ``Store`` can perform the effects after the reducer is done running.
6789
///
68-
/// ```swift
69-
/// func reduce(into state: inout State, action: Action) -> EffectPublisher<Action, Never> { … }
70-
/// ```
90+
/// There are 2 distinct ways to create an `Effect`: one using Swift's native concurrency tools, and
91+
/// the other using Apple's Combine framework:
7192
///
72-
/// You can specify a single generic:
93+
/// * If using Swift's native structured concurrency tools then there are 3 main ways to create an
94+
/// effect, depending on if you want to emit one single action back into the system, or any number
95+
/// of actions, or just execute some work without emitting any actions:
96+
/// * ``EffectPublisher/task(priority:operation:catch:file:fileID:line:)``
97+
/// * ``EffectPublisher/run(priority:operation:catch:file:fileID:line:)``
98+
/// * ``EffectPublisher/fireAndForget(priority:_:)``
99+
/// * If using Combine in your application, in particular for the dependencies of your feature
100+
/// then you can create effects by making use of any of Combine's operators, and then erasing the
101+
/// publisher type to ``EffectPublisher`` with either `eraseToEffect` or `catchToEffect`. Note that
102+
/// the Combine interface to ``EffectPublisher`` is considered soft deprecated, and you should
103+
/// eventually port to Swift's native concurrency tools.
73104
///
74-
/// ```swift
75-
/// func reduce(into state: inout State, action: Action) -> EffectTask<Action> { … }
76-
/// ```
105+
/// > Important: The publisher interface to ``EffectTask`` is considered deperecated, and you should
106+
/// try converting any uses of that interface to Swift's native concurrency tools.
107+
/// >
108+
/// > Also, ``Store`` is not thread safe, and so all effects must receive values on the same
109+
/// thread. This is typically the main thread, **and** if the store is being used to drive UI then
110+
/// it must receive values on the main thread.
111+
/// >
112+
/// > This is only an issue if using the Combine interface of ``EffectPublisher`` as mentioned
113+
/// above. If you are using Swift's concurrency tools and the `.task`, `.run` and `.fireAndForget`
114+
/// functions on ``EffectTask``, then threading is automatically handled for you.
77115
public typealias EffectTask<Action> = Effect<Action, Never>
78116

79117
extension EffectPublisher where Failure == Never {
@@ -609,57 +647,20 @@ extension EffectPublisher {
609647
}
610648

611649
@available(
612-
iOS,
613-
deprecated: 9999.0,
650+
*,
614651
message:
615652
"""
616-
'Effect' has been deprecated in favor of 'EffectTask' when `Failure == Never`, or
617-
`EffectPublisher<Output, Failure>` in general.
653+
'Effect' has been deprecated in favor of 'EffectTask' when 'Failure == Never', or 'EffectPublisher<Output, Failure>' in general.
618654
619-
You are encouraged to use `EffectTask<Action>` to model the ouput of your reducers, and to Swift
620-
concurrency to model failable streams of values.
655+
You are encouraged to use 'EffectTask<Action>' to model the output of your reducers, and to use Swift concurrency to model failable streams of values.
621656
622-
See the migration roadmap for more information: https://github.com/pointfreeco/swift-composable-architecture/discussions/1477
623-
"""
624-
)
625-
@available(
626-
macOS,
627-
deprecated: 9999.0,
628-
message:
629-
"""
630-
'Effect' has been deprecated in favor of 'EffectTask' when `Failure == Never`, or
631-
`EffectPublisher<Output, Failure>` in general.
632-
633-
You are encouraged to use `EffectTask<Action>` to model the ouput of your reducers, and to Swift
634-
concurrency to model failable streams of values.
657+
To find and replace instances of 'Effect<Action, Never>' to 'EffectTask<Action, Never>' in your codebase, use the following regular expression:
635658
636-
See the migration roadmap for more information: https://github.com/pointfreeco/swift-composable-architecture/discussions/1477
637-
"""
638-
)
639-
@available(
640-
tvOS,
641-
deprecated: 9999.0,
642-
message:
643-
"""
644-
'Effect' has been deprecated in favor of 'EffectTask' when `Failure == Never`, or
645-
`EffectPublisher<Output, Failure>` in general.
646-
647-
You are encouraged to use `EffectTask<Action>` to model the ouput of your reducers, and to Swift
648-
concurrency to model failable streams of values.
659+
Find:
660+
Effect<([^,]+), Never>
649661
650-
See the migration roadmap for more information: https://github.com/pointfreeco/swift-composable-architecture/discussions/1477
651-
"""
652-
)
653-
@available(
654-
watchOS,
655-
deprecated: 9999.0,
656-
message:
657-
"""
658-
'Effect' has been deprecated in favor of 'EffectTask' when `Failure == Never`, or
659-
`EffectPublisher<Output, Failure>` in general.
660-
661-
You are encouraged to use `EffectTask<Action>` to model the ouput of your reducers, and to Swift
662-
concurrency to model failable streams of values.
662+
Replace:
663+
EffectTask<$1>
663664
664665
See the migration roadmap for more information: https://github.com/pointfreeco/swift-composable-architecture/discussions/1477
665666
"""

0 commit comments

Comments
 (0)