Skip to content

Commit e4d62bf

Browse files
mbrandonwmluisbrown
authored andcommitted
Update Effect internals to be more efficient. (#1312)
* Distinguish Combine and async effects from each other * wip * wip * wip * Add some tests * wip * wip * wip Co-authored-by: Stephen Celis <[email protected]> (cherry picked from commit 7b5bc85f2eac9e8290b74e41f5a8b3d1136b1928) # Conflicts: # Sources/ComposableArchitecture/Debugging/ReducerDebugging.swift # Sources/ComposableArchitecture/Debugging/ReducerInstrumentation.swift # Sources/ComposableArchitecture/Effect.swift # Sources/ComposableArchitecture/Effects/Animation.swift # Sources/ComposableArchitecture/Effects/Cancellation.swift # Sources/ComposableArchitecture/Effects/Debouncing.swift # Sources/ComposableArchitecture/Effects/Deferring.swift # Sources/ComposableArchitecture/Effects/SignalProducer.swift # Sources/ComposableArchitecture/Effects/Throttling.swift # Sources/ComposableArchitecture/Internal/TaskCancellableValue.swift # Sources/ComposableArchitecture/Store.swift # Tests/ComposableArchitectureTests/EffectFailureTests.swift # Tests/ComposableArchitectureTests/EffectTests.swift
1 parent 4d2e016 commit e4d62bf

File tree

28 files changed

+840
-458
lines changed

28 files changed

+840
-458
lines changed

Examples/CaseStudies/SwiftUICaseStudies/00-Core.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,6 @@ let rootReducer = Reducer<RootState, RootAction, RootEnvironment>.combine(
276276
environment: { .init(mainQueue: $0.mainQueue, webSocket: $0.webSocket) }
277277
)
278278
)
279-
.debug()
280-
.signpost()
281279

282280
@Sendable private func liveFetchNumber() async throws -> Int {
283281
try await Task.sleep(nanoseconds: NSEC_PER_SEC)

Examples/CaseStudies/SwiftUICaseStudies/04-HigherOrderReducers-ResuableOfflineDownloads/DownloadClient.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Combine
22
import ComposableArchitecture
33
import Foundation
4+
import XCTestDynamicOverlay
45

56
struct DownloadClient {
67
var download: @Sendable (URL) -> AsyncThrowingStream<Event, Error>
@@ -38,4 +39,8 @@ extension DownloadClient {
3839
}
3940
}
4041
)
42+
43+
static let unimplemented = Self(
44+
download: XCTUnimplemented("\(Self.self).asyncDownload")
45+
)
4146
}

Examples/CaseStudies/SwiftUICaseStudies/CaseStudiesApp.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ struct CaseStudiesApp: App {
88
RootView(
99
store: Store(
1010
initialState: RootState(),
11-
reducer: rootReducer,
11+
reducer: rootReducer
12+
.debug()
13+
.signpost(),
1214
environment: .live
1315
)
1416
)

Examples/CaseStudies/SwiftUICaseStudiesTests/04-HigherOrderReducers-ReusableOfflineDownloadsTests.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import ComposableArchitecture
22
import ReactiveSwift
33
import XCTest
4-
import XCTestDynamicOverlay
54

65
@testable import SwiftUICaseStudies
76

@@ -161,9 +160,3 @@ final class ReusableComponentsDownloadComponentTests: XCTestCase {
161160
}
162161
}
163162
}
164-
165-
extension DownloadClient {
166-
static let unimplemented = Self(
167-
download: XCTUnimplemented("\(Self.self).asyncDownload")
168-
)
169-
}

Examples/Search/Search/SearchApp.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ struct SearchApp: App {
88
SearchView(
99
store: Store(
1010
initialState: SearchState(),
11-
reducer: searchReducer.debug(),
11+
reducer: searchReducer
12+
.debug(),
1213
environment: SearchEnvironment(
1314
weatherClient: WeatherClient.live
1415
)

Examples/SpeechRecognition/SpeechRecognition/SpeechRecognition.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ let appReducer = Reducer<AppState, AppAction, AppEnvironment> { state, action, e
102102
}
103103
}
104104
}
105-
.debug()
106105

107106
struct SpeechRecognitionView: View {
108107
let store: Store<AppState, AppAction>

Examples/SpeechRecognition/SpeechRecognition/SpeechRecognitionApp.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ struct SpeechRecognitionApp: App {
88
SpeechRecognitionView(
99
store: Store(
1010
initialState: AppState(),
11-
reducer: appReducer,
11+
reducer: appReducer
12+
.debug(),
1213
environment: AppEnvironment(
1314
speechClient: .live
1415
)

Examples/TicTacToe/App/RootView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ enum GameType: Identifiable {
3030
struct RootView: View {
3131
let store = Store(
3232
initialState: AppState(),
33-
reducer: appReducer,
33+
reducer: appReducer
34+
.debug(),
3435
environment: AppEnvironment(
3536
authenticationClient: .live
3637
)

Examples/TicTacToe/tic-tac-toe/Sources/AppCore/AppCore.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,3 @@ public let appReducer = Reducer<AppState, AppAction, AppEnvironment>.combine(
6060
}
6161
}
6262
)
63-
.debug()

Examples/Todos/Todos/TodosApp.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ struct TodosApp: App {
99
AppView(
1010
store: Store(
1111
initialState: AppState(),
12-
reducer: appReducer.debug(),
12+
reducer: appReducer
13+
.debug(),
1314
environment: AppEnvironment(
1415
mainQueue: QueueScheduler.main,
1516
uuid: { UUID() }

0 commit comments

Comments
 (0)