SwiftUI-Redux icon indicating copy to clipboard operation
SwiftUI-Redux copied to clipboard

need to store subscription to make it work

Open haifengkao opened this issue 5 years ago • 1 comments

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.

haifengkao avatar Sep 13 '20 10:09 haifengkao

That's true. I guess I haven't updated since it worked without storing subscription, will update them. Thanks!

kitasuke avatar Sep 21 '20 01:09 kitasuke