kitasuke / SwiftUI-Redux

Sample iOS project built by SwiftUI + Redux(ReSwift) and Combine framework using GitHub API
MIT License
108 stars 12 forks source link

need to store subscription to make it work #1

Open haifengkao opened 4 years ago

haifengkao commented 4 years ago

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.

kitasuke commented 4 years ago

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