I have a layered architectured application where I am getting array of objects in ViewModel and binding it with tableview in ViewController. Following is my code: ViewModel:
func getManufacturerList() -> Single<[ManufacturerItem]> {
return self.fetchManufacturerInteractor.getManufacturerList()
.map { $0.map { ManufacturerItem(
manufacturerName: $0.manufacturerName,
manufacturerID: $0.manufacturerID) } }
}
Above function receives array of objects from some other layer which again gets it from NetworkLayer.
ViewController:
private func setUpViewBinding() {
manufacturerViewModel.getManufacturerList()
.asObservable()
.bind(to: tableView.rx.items(cellIdentifier: LanguageSelectionTableViewCell.Identifier,
cellType: LanguageSelectionTableViewCell.self)) { row, manufacturer, cell in
cell.textLabel?.text = manufacturer.manufacturerName
cell.textLabel?.font = AppFonts.appBoldFont(size: 16).value
cell.accessibilityIdentifier = "rowLanguage\(row+1)"
cell.textLabel?.accessibilityIdentifier = tblCellLabelAccessibilityIdentifier
}.disposed(by: self.disposeBag)
}
Now where should I add the code for showing/hiding the activity indicator?