Skip to content

Commit 41f1cb9

Browse files
Add a EffectTask<Action> typealias for Effect<Action, Never> and rename Effect to EffectPublisher (#1471)
* Add an `EffectOf<Action>` typealias for `Effect<Action, Never>` * Fix doc * Rename `EffectOf` to `EffectTask` * Rename `Effect` to `EffectPublisher` * Soft-deprecate `Effect` * Link to `EffectTask` * Use `EffectPublisher` in Combine contexts * Reword soft-deprecation message * Remove `renamed:` fix-it for `Effect` deprecation * Update Sources/ComposableArchitecture/Documentation.docc/Extensions/ReducerProtocol.md Co-authored-by: Stephen Celis <[email protected]> * Update Sources/ComposableArchitecture/Documentation.docc/ComposableArchitecture.md * Update Sources/ComposableArchitecture/Effect.swift * Fix DocC identifiers Co-authored-by: Stephen Celis <[email protected]>
1 parent e726a13 commit 41f1cb9

File tree

99 files changed

+567
-465
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+567
-465
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct AlertAndConfirmationDialog: ReducerProtocol {
3737
case incrementButtonTapped
3838
}
3939

40-
func reduce(into state: inout State, action: Action) -> Effect<Action, Never> {
40+
func reduce(into state: inout State, action: Action) -> EffectTask<Action> {
4141
switch action {
4242
case .alertButtonTapped:
4343
state.alert = AlertState(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ struct Animations: ReducerProtocol {
4040

4141
@Dependency(\.mainQueue) var mainQueue
4242

43-
func reduce(into state: inout State, action: Action) -> Effect<Action, Never> {
43+
func reduce(into state: inout State, action: Action) -> EffectTask<Action> {
4444
enum CancelID {}
4545

4646
switch action {

Examples/CaseStudies/SwiftUICaseStudies/01-GettingStarted-Bindings-Basics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ struct BindingBasics: ReducerProtocol {
3535
case toggleChanged(isOn: Bool)
3636
}
3737

38-
func reduce(into state: inout State, action: Action) -> Effect<Action, Never> {
38+
func reduce(into state: inout State, action: Action) -> EffectTask<Action> {
3939
switch action {
4040
case let .sliderValueChanged(value):
4141
state.sliderValue = value

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct Counter: ReducerProtocol {
2121
case incrementButtonTapped
2222
}
2323

24-
func reduce(into state: inout State, action: Action) -> Effect<Action, Never> {
24+
func reduce(into state: inout State, action: Action) -> EffectTask<Action> {
2525
switch action {
2626
case .decrementButtonTapped:
2727
state.count -= 1

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ struct SharedState: ReducerProtocol {
8888
case isPrimeButtonTapped
8989
}
9090

91-
func reduce(into state: inout State, action: Action) -> Effect<Action, Never> {
91+
func reduce(into state: inout State, action: Action) -> EffectTask<Action> {
9292
switch action {
9393
case .alertDismissed:
9494
state.alert = nil
@@ -140,7 +140,7 @@ struct SharedState: ReducerProtocol {
140140
case resetCounterButtonTapped
141141
}
142142

143-
func reduce(into state: inout State, action: Action) -> Effect<Action, Never> {
143+
func reduce(into state: inout State, action: Action) -> EffectTask<Action> {
144144
switch action {
145145
case .resetCounterButtonTapped:
146146
state.resetCount()

Examples/CaseStudies/SwiftUICaseStudies/02-Effects-Basics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct EffectsBasics: ReducerProtocol {
3939
@Dependency(\.mainQueue) var mainQueue
4040
private enum DelayID {}
4141

42-
func reduce(into state: inout State, action: Action) -> Effect<Action, Never> {
42+
func reduce(into state: inout State, action: Action) -> EffectTask<Action> {
4343
switch action {
4444
case .decrementButtonTapped:
4545
state.count -= 1

Examples/CaseStudies/SwiftUICaseStudies/02-Effects-Cancellation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct EffectsCancellation: ReducerProtocol {
3131
@Dependency(\.factClient) var factClient
3232
private enum NumberFactRequestID {}
3333

34-
func reduce(into state: inout State, action: Action) -> Effect<Action, Never> {
34+
func reduce(into state: inout State, action: Action) -> EffectTask<Action> {
3535
switch action {
3636
case .cancelButtonTapped:
3737
state.isFactRequestInFlight = false

Examples/CaseStudies/SwiftUICaseStudies/02-Effects-LongLiving.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct LongLivingEffects: ReducerProtocol {
2929

3030
@Dependency(\.screenshots) var screenshots
3131

32-
func reduce(into state: inout State, action: Action) -> Effect<Action, Never> {
32+
func reduce(into state: inout State, action: Action) -> EffectTask<Action> {
3333
switch action {
3434
case .task:
3535
// When the view appears, start the effect that emits when screenshots are taken.

Examples/CaseStudies/SwiftUICaseStudies/02-Effects-Refreshable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct Refreshable: ReducerProtocol {
3131
@Dependency(\.mainQueue) var mainQueue
3232
private enum FactRequestID {}
3333

34-
func reduce(into state: inout State, action: Action) -> Effect<Action, Never> {
34+
func reduce(into state: inout State, action: Action) -> EffectTask<Action> {
3535
switch action {
3636
case .cancelButtonTapped:
3737
return .cancel(id: FactRequestID.self)

Examples/CaseStudies/SwiftUICaseStudies/02-Effects-Timers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ struct Timers: ReducerProtocol {
2626
@Dependency(\.mainQueue) var mainQueue
2727
private enum TimerID {}
2828

29-
func reduce(into state: inout State, action: Action) -> Effect<Action, Never> {
29+
func reduce(into state: inout State, action: Action) -> EffectTask<Action> {
3030
switch action {
3131
case .onDisappear:
3232
return .cancel(id: TimerID.self)

0 commit comments

Comments
 (0)