Skip to content

Instantly share code, notes, and snippets.

@O-O-wl
Last active July 9, 2020 02:07
Show Gist options
  • Save O-O-wl/3879af52753985bb6ec9f2601dca48e9 to your computer and use it in GitHub Desktop.
Save O-O-wl/3879af52753985bb6ec9f2601dca48e9 to your computer and use it in GitHub Desktop.
func render(for state: Observable<ViewModel.State>) {
state.map { $0.onProcess }
.distinctUntilChanged()
.bind(to: indicator.rx.isAnimating)
.disposed(by: disposeBag)
state.map { $0.searchResults }
.distinctUntilChanged()
.bind(to: tableView.rx.items(cellIdentifier: ReuseIdentifier.default)) { indexPath, searchResult, cell in
cell.configure(searchResult)
}
.disposed(by: disposeBag)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment