I am learning rxswift and I have a ViewController
with a tableView
.
I am using the MVVM architecture, so a tableView
is bound to a ViewModel
and it displays data well.
But I want put a TableView
label empty state when I don't have data
and I don't know how to do it, if it's possible.
This is my code so far:
func bindViewModel() {
let inputs = viewModel.inputs
let outputs = viewModel.outputs
btnSomeAction.rx.action = inputs.someAction
outputs.usersList
.bind(to: tableView.rx.items(cellIdentifier: "UserTableViewCell", cellType: UserTableViewCell.self)) { (_,element,cell) in
cell.setData(name: element.name, avatar: element.avatar)
}
.disposed(by: disposeBag)
}
Thanks to all for any help.
P.S.:
I know how to do it in a general table without rx
with amount of element zero. The question is about rxtable
.