Hi, I need to run a publisher function, returning AnyPublisher<Void, Never> from inside a reducer. How to do it properly?
For example,
func requestData() -> AnyPublisher<Void, Never> {
Deferred<PassthroughSubject<Void, Never>> {
do stuff
}.eraseToAnyPublisher()
}
This data request triggers changes in the "outside world" (external repository, which is not in the scope of the TCA Store/State). Before loading a view I need to trigger that data request and then listen to another publisher, which result is returned as an Effect in the same reducer.
Reducer looks something like this:
case .getData:
return .merge(
environment
.repository
.requestData(),
environment
.repository
.dataPublisher
.map(PresentAndLoadAction.updateData)
.eraseToEffect()
)
Thanks!