diff --git a/Example/example-app/Sources/AppFeature/App.swift b/Example/example-app/Sources/AppFeature/App.swift index 06477b12909ed045647364b6d209c1256307d154..16d9b87a7ff78c79866c82132d612bf5d68427d3 100644 --- a/Example/example-app/Sources/AppFeature/App.swift +++ b/Example/example-app/Sources/AppFeature/App.swift @@ -47,6 +47,7 @@ extension AppEnvironment { bgScheduler: bgScheduler, mainScheduler: mainScheduler, makeId: UUID.init, + error: ErrorEnvironment(), myIdentity: MyIdentityEnvironment() ) ) diff --git a/Example/example-app/Sources/SessionFeature/SessionFeature.swift b/Example/example-app/Sources/SessionFeature/SessionFeature.swift index f3ba93262307cc067732c18068fcc4dddc25989f..ae1afd736eeced1f798061205266ebc49d409671 100644 --- a/Example/example-app/Sources/SessionFeature/SessionFeature.swift +++ b/Example/example-app/Sources/SessionFeature/SessionFeature.swift @@ -47,12 +47,14 @@ public struct SessionEnvironment { bgScheduler: AnySchedulerOf<DispatchQueue>, mainScheduler: AnySchedulerOf<DispatchQueue>, makeId: @escaping () -> UUID, + error: ErrorEnvironment, myIdentity: MyIdentityEnvironment ) { self.getClient = getClient self.bgScheduler = bgScheduler self.mainScheduler = mainScheduler self.makeId = makeId + self.error = error self.myIdentity = myIdentity } @@ -60,6 +62,7 @@ public struct SessionEnvironment { public var bgScheduler: AnySchedulerOf<DispatchQueue> public var mainScheduler: AnySchedulerOf<DispatchQueue> public var makeId: () -> UUID + public var error: ErrorEnvironment public var myIdentity: MyIdentityEnvironment } @@ -156,6 +159,13 @@ public let sessionReducer = Reducer<SessionState, SessionAction, SessionEnvironm return .none } } +.presenting( + errorReducer, + state: .keyPath(\.error), + id: .keyPath(\.?.error), + action: /SessionAction.error, + environment: \.error +) .presenting( myIdentityReducer, state: .keyPath(\.myIdentity), @@ -171,6 +181,7 @@ extension SessionEnvironment { bgScheduler: .failing, mainScheduler: .failing, makeId: { fatalError() }, + error: .failing, myIdentity: .failing ) }