SwiftUI-Redux
SwiftUI-Redux copied to clipboard
need to store subscription to make it work
the call
APIService().response(from: SearchRepositoryRequest())
and
action.future .receive(on: DispatchQueue.main) .sink(receiveValue: { next($0) })
should be
subscription = APIService().response(from: SearchRepositoryRequest())
subscription = action.future .receive(on: DispatchQueue.main) .sink(receiveValue: { next($0) })
if you don't store the subscription somewhere, the subscription will be cancelled immediately.
That's true. I guess I haven't updated since it worked without storing subscription, will update them. Thanks!