Skip to content

Instantly share code, notes, and snippets.

@fadion
Last active April 14, 2017 11:07
Show Gist options
  • Save fadion/dd010e3984d33211b7a493089ce54732 to your computer and use it in GitHub Desktop.
Save fadion/dd010e3984d33211b7a493089ce54732 to your computer and use it in GitHub Desktop.
func fillWithData() {
PizzaManager().all()
.subscribe(onNext: { [weak self] pizza in
self?.pizzaViewModel.value = pizza
}, onError: { [weak self] _ in
if self?.pizzaViewModel.value.count == 0 {
self?.pizzaCollectionView.backgroundView = NetworkErrorView(withAction: {
self?.fillWithData()
})
}
}).disposed(by: self.disposeBag)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment