Open haifengkao opened 4 years ago
the call APIService().response(from: SearchRepositoryRequest()) and action.future .receive(on: DispatchQueue.main) .sink(receiveValue: { next($0) })
APIService().response(from: SearchRepositoryRequest())
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) })
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!
the call
APIService().response(from: SearchRepositoryRequest())
andaction.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.