We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
We need refresh and paginated search examples. I made a solution like this. But if there is more compact and convenient solution please share with us.
` typealias Page = PaginatedResponseData
let steps = PublishRelay<Step>() private let disposeBag = DisposeBag() private var disposable: Disposable? private let service = UpSocialExplorePeopleSearchService() let data = BehaviorRelay<[UpSocialExplorePeopleSearchItem]>(value: []) var items: [UpSocialExplorePeopleSearchItem] { data.value } private(set) var pager: Pager<Page>? private func createPager(_ searchText: String) -> Pager<Page> { let pager = Pager<Page>(make: {[weak self] previousPage in guard let self = self else { return Observable.just(Page(currentPage: 0, lastPage: 1, nextPageUrl: nil, data: [])) } return self.service.browse(searchText: searchText, page: (previousPage?.currentPage ?? 0) + 1).asObservable() .catch { error in print(error) return Observable.just(Page(currentPage: 0, lastPage: 1, nextPageUrl: nil, data: [])) } }, while: { page in page.currentPage < page.lastPage }) return pager } func browse(searchText: String) { data.accept([]) disposable?.dispose() pager = createPager(searchText) disposable = pager?.page .withUnretained(self) .debug("Page") .bind { vm, page in vm.data.accept(vm.data.value + page.data) } disposable?.disposed(by: disposeBag) }
`
The text was updated successfully, but these errors were encountered:
No branches or pull requests
We need refresh and paginated search examples. I made a solution like this. But if there is more compact and convenient solution please share with us.
`
typealias Page = PaginatedResponseData
`
The text was updated successfully, but these errors were encountered: